← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/cmdline into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/cmdline into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/cmdline/+merge/61878

Open service file on command line for Windows, or by file association.

Fix the problem with QCoreApplication choosing to ignore the arguments passed to its constructor on Windows. 

**Please could someone on a non-Windows platform check I haven't broken it for you. Thanks.**
-- 
https://code.launchpad.net/~j-corwin/openlp/cmdline/+merge/61878
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/cmdline into lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2011-05-09 08:15:59 +0000
+++ openlp.pyw	2011-05-21 22:25:57 +0000
@@ -85,10 +85,13 @@
         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 +118,7 @@
         # 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 +253,7 @@
         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__':
     """

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-05-20 11:45:39 +0000
+++ openlp/core/ui/mainwindow.py	2011-05-21 22:25:57 +0000
@@ -625,11 +625,7 @@
         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])

=== modified file 'resources/windows/OpenLP-2.0.iss'
--- resources/windows/OpenLP-2.0.iss	2011-05-13 01:23:01 +0000
+++ resources/windows/OpenLP-2.0.iss	2011-05-21 22:25:57 +0000
@@ -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 @@
 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 @@
 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;


Follow ups