From 0c365e2a5900ee40320eaf2a81fbffdd46daa7f1 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Sat, 21 May 2011 23:16:28 +0100 Subject: [PATCH] Windows command line --- openlp.pyw | 10 ++++++---- openlp/core/ui/mainwindow.py | 6 +----- resources/windows/OpenLP-2.0.iss | 9 +++++++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 76d334bae..a97dc6e2e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -77,7 +77,6 @@ class OpenLP(QtGui.QApplication): The core application class. This class inherits from Qt's QApplication class in order to provide the core of the application. """ - def exec_(self): """ Override exec method to allow the shared memory to be released on exit @@ -85,10 +84,13 @@ class OpenLP(QtGui.QApplication): QtGui.QApplication.exec_() self.sharedMemory.detach() - def run(self): + def run(self, args): """ Run the OpenLP application. """ + # On Windows, the args passed into the constructor are + # ignored. Not very handy, so set the ones we want to use. + self.args = args # provide a listener for widgets to reqest a screen update. QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) @@ -115,7 +117,7 @@ class OpenLP(QtGui.QApplication): # make sure Qt really display the splash screen self.processEvents() # start the main app window - self.mainWindow = MainWindow(self.clipboard(), self.arguments()) + self.mainWindow = MainWindow(self.clipboard(), self.args) self.mainWindow.show() if show_splash: # now kill the splashscreen @@ -250,7 +252,7 @@ def main(): log.debug(u'Could not find default_translator.') if not options.no_error_form: sys.excepthook = app.hookException - sys.exit(app.run()) + sys.exit(app.run(qt_args)) if __name__ == u'__main__': """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 09e2ec9e7..6fec3a40b 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -615,11 +615,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if self.liveController.display.isVisible(): self.liveController.display.setFocus() self.activateWindow() - # On Windows, arguments contains the entire commandline - # So args[0]=='python' args[1]=='openlp.pyw' - # Therefore this approach is not going to work - # Bypass for now. - if len(self.arguments) and os.name != u'nt': + if len(self.arguments): args = [] for a in self.arguments: args.extend([a]) diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index 9f193b0e8..adeb4ef7c 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -16,7 +16,7 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{AA7699FA-B2D2-43F4-8A70-D497D03C9485} +AppID={{AA7699FA-B2D2-43F4-8A70-D497D03C9485} AppName={#AppName} AppVerName={#AppVerName} AppPublisher={#AppPublisher} @@ -29,11 +29,12 @@ AllowNoIcons=true LicenseFile=LICENSE.txt OutputDir=..\..\dist OutputBaseFilename=OpenLP-{#RealVersion}-setup -Compression=lzma +Compression=lzma/Max SolidCompression=true SetupIconFile=OpenLP.ico WizardImageFile=WizImageBig.bmp WizardSmallImageFile=WizImageSmall.bmp +ChangesAssociations=true [Languages] Name: english; MessagesFile: compiler:Default.isl @@ -79,6 +80,10 @@ Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filenam Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent [Registry] +Root: HKCR; Subkey: ".osz"; ValueType: string; ValueName: ""; ValueData: "OpenLP"; Flags: uninsdeletevalue +Root: HKCR; Subkey: "OpenLP"; ValueType: string; ValueName: ""; ValueData: "OpenLP Service"; Flags: uninsdeletekey +Root: HKCR; Subkey: "OpenLP\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\OpenLP.exe,0" +Root: HKCR; Subkey: "OpenLP\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\OpenLP.exe"" ""%1""" [Code] function GetUninstallString(): String;