Merge branch 'master' of github.com:jeena/Bungloo

This commit is contained in:
Jeena Paradies 2013-02-27 22:12:06 +01:00
commit 83aa055714
4 changed files with 65 additions and 6 deletions

View file

@ -2,7 +2,13 @@
import os, sys, pickle, subprocess
from PyQt4 import QtCore, QtGui, QtWebKit
import Windows, Helper
if __file__ == 'Bungloo.py':
import Windows, Helper
else:
from bungloo import Windows, Helper
import shutil
class Bungloo:
@ -23,7 +29,10 @@ class Bungloo:
self.app.exec_()
def resources_path(self):
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if __file__ == 'Bungloo.py':
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
else:
return Helper.Helper.get_resource_path()
def resources_uri(self):
return "file://localhost" + os.path.abspath(os.path.join(self.resources_path(), "WebKit"))
@ -64,10 +73,16 @@ class Controller(QtCore.QObject):
QtCore.QObject.__init__(self)
self.app = app
if not os.path.exists(os.path.expanduser("~/.bungloo/")):
os.makedirs(os.path.expanduser("~/.bungloo/"))
oldpath = os.path.expanduser('~/.bungloo/')
if os.path.isdir(oldpath):
shutil.copytree(oldpath, os.path.expanduser('~/.config/bungloo/'))
shutil.rmtree(os.path.expanduser('~/.bungloo/'))
if not os.path.exists(os.path.expanduser("~/.config/bungloo/")):
os.makedirs(os.path.expanduser("~/.config/bungloo/"))
self.config_path = os.path.expanduser('~/.config/bungloo/bungloo.cfg')
self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg')
if os.access(self.config_path, os.R_OK):
with open(self.config_path, 'r') as f:
self.config = pickle.load(f)

View file

@ -9,6 +9,11 @@ import os
import array
class Helper:
@classmethod
def get_resource_path(cls):
return os.path.dirname(__file__)
class WebPage(QtWebKit.QWebPage):
def __init__(self, parent=0, app=None):
super(QtWebKit.QWebPage, self).__init__(parent)
@ -125,4 +130,4 @@ class RestorableWindow(QtGui.QMainWindow):
def show(self):
QtGui.QMainWindow.show(self)
self.activateWindow()
self.raise_()
self.raise_()

14
Linux/deploy.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
mkdir -p build
mkdir -p build/bin
mkdir -p build/bungloo
touch build/bungloo/__init__.py
cp Bungloo.py build/bin/bungloo
cp Helper.py Windows.py build/bungloo
cp setup.py build/
cp -r ../WebKit build/bungloo/
cp -r ../images build/bungloo/
# eof

25
Linux/setup.py Normal file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env python2
import os
from distutils.core import setup
files = []
for dirname, dirnames, filenames in os.walk('bungloo/WebKit'):
for filename in filenames:
files += [os.path.join(dirname, filename)[8:]]
for dirname, dirnames, filenames in os.walk('bungloo/images'):
for filename in filenames:
files += [os.path.join(dirname, filename)[8:]]
setup(
name = "bungloo",
version = "0.1",
author = "Jeena Paradies",
author_email = "spam@jeenaparadies.net",
url = "http://jabs.nu/bungloo",
license = "BSD license",
packages = ['bungloo'],
package_data = {"bungloo": files},
scripts = ["bin/bungloo"]
)