Skip to content

Commit

Permalink
support for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
d0m1n1kr committed Feb 12, 2013
1 parent ecf8240 commit e80a3f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@
import platform, sys

setup(name='wallaby-frontend-qt',
version='0.2.54',
version='0.2.55',
url='https://github.com/FreshXOpenSource/wallaby-frontend-qt',
author='FreshX GbR',
author_email='wallaby@freshx.de',
Expand Down
9 changes: 7 additions & 2 deletions wallaby/apps/wallabyApp.py
Expand Up @@ -77,8 +77,13 @@ def __init__(self, appName = 'example', checkRoom = None, suggest = False, optio
FX.appPath = os.path.join(".", "wallaby", "apps", appName)

try:
print "importing", FX.appModule
mod = FX.imp(FX.appModule + '.mainWindow', False)
print "importing", options.module, "from", FX.appModule
if options.module == "WallabyApp2" and os.path.exists(os.path.join(FX.appPath, "mainWindow.py")):
mod = FX.imp(FX.appModule + '.mainWindow', False)
else:
module = options.module
module = module[0].lower() + module[1:]
mod = FX.imp(FX.appModule + '.' + module, False)
except:
mod = None

Expand Down
6 changes: 3 additions & 3 deletions wallaby/frontends/qt/baseWindow.py
Expand Up @@ -19,7 +19,7 @@

class BaseWindow(BaseApp, QtGui.QMainWindow):
def __init__(self, vendorName, appName, options, quitCB, parent=None, dbName=None, embedded=False, *args, **ka):
BaseApp.__init__(self, quitCB, dbName, embedded=embedded, appName=appName)
BaseApp.__init__(self, quitCB, dbName, embedded=embedded, appName=appName, module=options.module)
QtGui.QMainWindow.__init__(self, parent)

self._options = options
Expand All @@ -38,7 +38,7 @@ def __init__(self, vendorName, appName, options, quitCB, parent=None, dbName=Non

self._splash = None

self._settings = QtCore.QSettings(vendorName, appName)
self._settings = QtCore.QSettings(vendorName, appName + "_" + options. module)

def settings(self):
return self._settings
Expand Down Expand Up @@ -145,7 +145,7 @@ def isRunning(self):
if self._splash != None: reactor.callLater(0.3, self._splash.finish, self)

def closeEvent(self, e):
settings = QtCore.QSettings(self._vendorName, self._appName)
settings = QtCore.QSettings(self._vendorName, self._appName + "_" + self._options.module)
settings.setValue("geometry", self.saveGeometry())
settings.setValue("windowState", self.saveState())
settings.sync()
Expand Down
10 changes: 8 additions & 2 deletions wlby
Expand Up @@ -178,8 +178,13 @@ def startDesigner(options):

else:
for path in appPath:
path = os.path.join(path, "mainWindow.ui")
if os.path.exists(path):
if options.module == "WallabyApp2" and os.path.exists(os.path.join(path, "mainWindow.ui")):
path = os.path.join(path, "mainWindow.ui")
else:
module = options.module
module = module[0].lower() + module[1:]
path = os.path.join(path, module + ".ui")
if os.path.exists(path) or options.module != "WallabyApp2":
designer.start(designer_bin, [path])
found = True
break
Expand Down Expand Up @@ -270,6 +275,7 @@ def main():

parser = OptionParser()
parser.add_option("-a" , dest="app" , default=None, help="The application name. If you are in a wallaby application folder, this option could be omitted.")
parser.add_option("-m" , dest="module" , default="WallabyApp2", help="The modules name. Defaults to WallabyApp2.")
parser.add_option("--username", dest="username" , default=None, help="The user to authenticate with the backends.")
parser.add_option("--password", dest="password" , default=None, help="The password to authenticate with the backends.")

Expand Down

0 comments on commit e80a3f1

Please sign in to comment.