openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01199
[Merge] lp:~crichter/openlp/testing into lp:openlp
rimach has proposed merging lp:~crichter/openlp/testing into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
- add portable option
- make blank button workable
--
https://code.launchpad.net/~crichter/openlp/testing/+merge/21574
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw 2010-03-12 18:31:13 +0000
+++ openlp.pyw 2010-03-17 16:43:16 +0000
@@ -155,35 +155,39 @@
help="Set logging to LEVEL level. Valid values are "
"\"debug\", \"info\", \"warning\".")
parser.add_option("-p", "--portable", dest="portable",
- action="store_true",
- help="Specify if this should be run as a portable app, "
- "off a USB flash drive.")
+ default="../openlp-data", metavar="APP_PATH",
+ help="Specify relative Path where database should be located. E.g. ../openlp-data")
parser.add_option("-s", "--style", dest="style",
help="Set the Qt4 style (passed directly to Qt4).")
- # Set up logging
- log_path = AppLocation.get_directory(AppLocation.ConfigDir)
- if not os.path.exists(log_path):
- os.makedirs(log_path)
- filename = os.path.join(log_path, u'openlp.log')
- logfile = FileHandler(filename, u'w')
- logfile.setFormatter(logging.Formatter(
- u'%(asctime)s %(name)-20s %(levelname)-8s %(message)s'))
- log.addHandler(logfile)
- logging.addLevelName(15, u'Timer')
+
# Parse command line options and deal with them.
(options, args) = parser.parse_args()
qt_args = []
if options.loglevel.lower() in ['d', 'debug']:
log.setLevel(logging.DEBUG)
- print 'Logging to:', filename
+ #print 'Logging to:', filename
elif options.loglevel.lower() in ['w', 'warning']:
log.setLevel(logging.WARNING)
else:
log.setLevel(logging.INFO)
if options.style:
qt_args.extend(['-style', options.style])
+ if options.portable:
+ os.environ['PORTABLE'] = options.portable
# Throw the rest of the arguments at Qt, just in case.
qt_args.extend(args)
+
+ # Set up logging
+ log_path = AppLocation.get_directory(AppLocation.ConfigDir)
+ if not os.path.exists(log_path):
+ os.makedirs(log_path)
+ filename = os.path.join(log_path, u'openlp.log')
+ logfile = FileHandler(filename, u'w')
+ logfile.setFormatter(logging.Formatter(
+ u'%(asctime)s %(name)-20s %(levelname)-8s %(message)s'))
+ log.addHandler(logfile)
+ logging.addLevelName(15, u'Timer')
+
# Initialise the resources
qInitResources()
# Now create and actually run the application.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2010-03-14 17:05:50 +0000
+++ openlp/core/ui/maindisplay.py 2010-03-17 16:43:16 +0000
@@ -226,6 +226,7 @@
``frame``
Image frame to be rendered
"""
+ log.debug(u'frameView %d' % (self.displayBlank))
if not self.displayBlank:
if transition:
if self.frame is not None:
@@ -248,14 +249,22 @@
if not self.isVisible():
self.setVisible(True)
self.showFullScreen()
+ else:
+ self.waitingFrame = frame
+ self.waitingFrameTrans = transition
def blankDisplay(self, blanked=True):
+ log.debug(u'Blank main Display %d' % blanked)
if blanked:
self.displayBlank = True
self.display_text.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
+ self.waitingFrame = None
+ self.waitingFrameTrans = False
else:
self.displayBlank = False
- if self.display_frame:
+ if self.waitingFrame:
+ self.frameView(self.waitingFrame, self.waitingFrameTrans)
+ elif self.display_frame:
self.frameView(self.display_frame)
def onMediaQueue(self, message):
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2010-03-13 15:11:31 +0000
+++ openlp/core/ui/slidecontroller.py 2010-03-17 16:43:16 +0000
@@ -524,6 +524,7 @@
"""
Handle the blank screen button
"""
+ log.debug(u'onBlankDisplay %d' % force)
if force:
self.blankButton.setChecked(True)
self.blankScreen(self.blankButton.isChecked())
@@ -540,6 +541,8 @@
Receiver.send_message(u'%s_blank'% self.serviceItem.name.lower())
else:
Receiver.send_message(u'%s_unblank'% self.serviceItem.name.lower())
+ else:
+ self.parent.mainDisplay.blankDisplay(blanked)
else:
self.parent.mainDisplay.blankDisplay(blanked)
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2010-03-12 18:31:13 +0000
+++ openlp/core/utils/__init__.py 2010-03-17 16:43:16 +0000
@@ -45,7 +45,10 @@
if dir_type == AppLocation.AppDir:
return os.path.abspath(os.path.split(sys.argv[0])[0])
elif dir_type == AppLocation.ConfigDir:
- if sys.platform == u'win32':
+ if os.getenv(u'PORTABLE') is not None:
+ path = os.path.split(os.path.abspath(sys.argv[0]))[0]
+ path = os.path.join(path, os.getenv(u'PORTABLE'))
+ elif sys.platform == u'win32':
path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
elif sys.platform == u'darwin':
path = os.path.join(os.getenv(u'HOME'), u'Library',
@@ -58,7 +61,10 @@
path = os.path.join(os.getenv(u'HOME'), u'.openlp')
return path
elif dir_type == AppLocation.DataDir:
- if sys.platform == u'win32':
+ if os.getenv(u'PORTABLE') is not None:
+ path = os.path.split(os.path.abspath(sys.argv[0]))[0]
+ path = os.path.join(path, os.getenv(u'PORTABLE'), u'data')
+ elif sys.platform == u'win32':
path = os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data')
elif sys.platform == u'darwin':
path = os.path.join(os.getenv(u'HOME'), u'Library',
Follow ups