forked from openlp/openlp
Truth testing cleanup
This commit is contained in:
parent
debaf91298
commit
51915d0e97
@ -128,7 +128,7 @@ class Renderer(object):
|
|||||||
``preview``
|
``preview``
|
||||||
Defaults to *False*. Whether or not to generate a preview.
|
Defaults to *False*. Whether or not to generate a preview.
|
||||||
"""
|
"""
|
||||||
if preview == True:
|
if preview:
|
||||||
self.bg_frame = None
|
self.bg_frame = None
|
||||||
log.debug(u'set frame dest (frame) w %d h %d', frame_width,
|
log.debug(u'set frame dest (frame) w %d h %d', frame_width,
|
||||||
frame_height)
|
frame_height)
|
||||||
|
@ -164,14 +164,14 @@ class RenderManager(object):
|
|||||||
log.debug(u'build_text_rectangle')
|
log.debug(u'build_text_rectangle')
|
||||||
main_rect = None
|
main_rect = None
|
||||||
footer_rect = None
|
footer_rect = None
|
||||||
if theme.font_main_override == False:
|
if not theme.font_main_override:
|
||||||
main_rect = QtCore.QRect(10, 0, self.width - 1,
|
main_rect = QtCore.QRect(10, 0, self.width - 1,
|
||||||
self.footer_start - 20)
|
self.footer_start - 20)
|
||||||
else:
|
else:
|
||||||
main_rect = QtCore.QRect(int(theme.font_main_x),
|
main_rect = QtCore.QRect(int(theme.font_main_x),
|
||||||
int(theme.font_main_y), int(theme.font_main_width)-1,
|
int(theme.font_main_y), int(theme.font_main_width)-1,
|
||||||
int(theme.font_main_height) - 1)
|
int(theme.font_main_height) - 1)
|
||||||
if theme.font_footer_override == False:
|
if not theme.font_footer_override:
|
||||||
footer_rect = QtCore.QRect(10,self.footer_start, self.width - 1,
|
footer_rect = QtCore.QRect(10,self.footer_start, self.width - 1,
|
||||||
self.height-self.footer_start)
|
self.height-self.footer_start)
|
||||||
else:
|
else:
|
||||||
|
@ -545,12 +545,12 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
self.FontFooterColorPushButton.setStyleSheet(
|
self.FontFooterColorPushButton.setStyleSheet(
|
||||||
u'background-color: %s' % unicode(theme.font_footer_color))
|
u'background-color: %s' % unicode(theme.font_footer_color))
|
||||||
|
|
||||||
if self.theme.font_main_override == False:
|
if not self.theme.font_main_override:
|
||||||
self.FontMainDefaultCheckBox.setChecked(True)
|
self.FontMainDefaultCheckBox.setChecked(True)
|
||||||
else:
|
else:
|
||||||
self.FontMainDefaultCheckBox.setChecked(False)
|
self.FontMainDefaultCheckBox.setChecked(False)
|
||||||
|
|
||||||
if self.theme.font_footer_override == False:
|
if not self.theme.font_footer_override:
|
||||||
self.FontFooterDefaultCheckBox.setChecked(True)
|
self.FontFooterDefaultCheckBox.setChecked(True)
|
||||||
else:
|
else:
|
||||||
self.FontFooterDefaultCheckBox.setChecked(False)
|
self.FontFooterDefaultCheckBox.setChecked(False)
|
||||||
@ -635,7 +635,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
self.GradientLabel.setVisible(False)
|
self.GradientLabel.setVisible(False)
|
||||||
self.GradientComboBox.setVisible(False)
|
self.GradientComboBox.setVisible(False)
|
||||||
|
|
||||||
if theme.font_main_override == False:
|
if not theme.font_main_override:
|
||||||
self.FontMainXSpinBox.setEnabled(False)
|
self.FontMainXSpinBox.setEnabled(False)
|
||||||
self.FontMainYSpinBox.setEnabled(False)
|
self.FontMainYSpinBox.setEnabled(False)
|
||||||
self.FontMainWidthSpinBox.setEnabled(False)
|
self.FontMainWidthSpinBox.setEnabled(False)
|
||||||
@ -646,7 +646,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
self.FontMainWidthSpinBox.setEnabled(True)
|
self.FontMainWidthSpinBox.setEnabled(True)
|
||||||
self.FontMainHeightSpinBox.setEnabled(True)
|
self.FontMainHeightSpinBox.setEnabled(True)
|
||||||
|
|
||||||
if theme.font_footer_override == False:
|
if not theme.font_footer_override:
|
||||||
self.FontFooterXSpinBox.setEnabled(False)
|
self.FontFooterXSpinBox.setEnabled(False)
|
||||||
self.FontFooterYSpinBox.setEnabled(False)
|
self.FontFooterYSpinBox.setEnabled(False)
|
||||||
self.FontFooterWidthSpinBox.setEnabled(False)
|
self.FontFooterWidthSpinBox.setEnabled(False)
|
||||||
|
@ -606,7 +606,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
"""
|
"""
|
||||||
Hook to close the main window and display windows on exit
|
Hook to close the main window and display windows on exit
|
||||||
"""
|
"""
|
||||||
if self.serviceNotSaved == True:
|
if self.serviceNotSaved:
|
||||||
ret = QtGui.QMessageBox.question(None,
|
ret = QtGui.QMessageBox.question(None,
|
||||||
self.trUtf8(u'Save Changes to Service?'),
|
self.trUtf8(u'Save Changes to Service?'),
|
||||||
self.trUtf8(u'Your service has changed, do you want to save those changes?'),
|
self.trUtf8(u'Your service has changed, do you want to save those changes?'),
|
||||||
@ -655,7 +655,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
service_name = u'(unsaved service)'
|
service_name = u'(unsaved service)'
|
||||||
else:
|
else:
|
||||||
service_name = serviceName
|
service_name = serviceName
|
||||||
if reset == True:
|
if reset:
|
||||||
self.serviceNotSaved = False
|
self.serviceNotSaved = False
|
||||||
title = u'%s - %s' % (self.mainTitle, service_name)
|
title = u'%s - %s' % (self.mainTitle, service_name)
|
||||||
else:
|
else:
|
||||||
|
@ -107,7 +107,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
self._clearDetails()
|
self._clearDetails()
|
||||||
|
|
||||||
def onStatusComboBoxChanged(self, status):
|
def onStatusComboBoxChanged(self, status):
|
||||||
if self.programaticChange is True:
|
if self.programaticChange:
|
||||||
self.programaticChange = False
|
self.programaticChange = False
|
||||||
return
|
return
|
||||||
self.activePlugin.toggle_status(status)
|
self.activePlugin.toggle_status(status)
|
||||||
|
@ -275,7 +275,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
|
|
||||||
def checkThemesExists(self, dir):
|
def checkThemesExists(self, dir):
|
||||||
log.debug(u'check themes')
|
log.debug(u'check themes')
|
||||||
if os.path.exists(dir) == False:
|
if not os.path.exists(dir):
|
||||||
os.mkdir(dir)
|
os.mkdir(dir)
|
||||||
|
|
||||||
def unzipTheme(self, filename, dir):
|
def unzipTheme(self, filename, dir):
|
||||||
@ -299,7 +299,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
for file in zip.namelist():
|
for file in zip.namelist():
|
||||||
if file.endswith(os.path.sep):
|
if file.endswith(os.path.sep):
|
||||||
theme_dir = os.path.join(dir, file)
|
theme_dir = os.path.join(dir, file)
|
||||||
if os.path.exists(theme_dir) == False:
|
if not os.path.exists(theme_dir):
|
||||||
os.mkdir(os.path.join(dir, file))
|
os.mkdir(os.path.join(dir, file))
|
||||||
else:
|
else:
|
||||||
fullpath = os.path.join(dir, file)
|
fullpath = os.path.join(dir, file)
|
||||||
@ -386,7 +386,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'saveTheme %s %s', name, theme_xml)
|
log.debug(u'saveTheme %s %s', name, theme_xml)
|
||||||
theme_dir = os.path.join(self.path, name)
|
theme_dir = os.path.join(self.path, name)
|
||||||
if os.path.exists(theme_dir) == False:
|
if not os.path.exists(theme_dir):
|
||||||
os.mkdir(os.path.join(self.path, name))
|
os.mkdir(os.path.join(self.path, name))
|
||||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||||
log.debug(theme_file)
|
log.debug(theme_file)
|
||||||
|
@ -44,17 +44,17 @@ class BibleCSVImpl(BibleCommon):
|
|||||||
QtCore.SIGNAL(u'openlpstopimport'), self.stop_import)
|
QtCore.SIGNAL(u'openlpstopimport'), self.stop_import)
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
self.loadbible= False
|
self.loadbible = False
|
||||||
|
|
||||||
def load_data(self, booksfile, versesfile, dialogobject):
|
def load_data(self, booksfile, versesfile, dialogobject):
|
||||||
#Populate the Tables
|
#Populate the Tables
|
||||||
fbooks=open(booksfile, 'r')
|
fbooks = open(booksfile, 'r')
|
||||||
fverse=open(versesfile, 'r')
|
fverse = open(versesfile, 'r')
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
for line in fbooks:
|
for line in fbooks:
|
||||||
# cancel pressed
|
# cancel pressed
|
||||||
if self.loadbible == False:
|
if not self.loadbible:
|
||||||
break
|
break
|
||||||
details = chardet.detect(line)
|
details = chardet.detect(line)
|
||||||
line = unicode(line, details['encoding'])
|
line = unicode(line, details['encoding'])
|
||||||
@ -72,7 +72,7 @@ class BibleCSVImpl(BibleCommon):
|
|||||||
count = 0
|
count = 0
|
||||||
book_ptr = None
|
book_ptr = None
|
||||||
for line in fverse:
|
for line in fverse:
|
||||||
if self.loadbible == False: # cancel pressed
|
if not self.loadbible: # cancel pressed
|
||||||
break
|
break
|
||||||
details = chardet.detect(line)
|
details = chardet.detect(line)
|
||||||
line = unicode(line, details['encoding'])
|
line = unicode(line, details['encoding'])
|
||||||
|
@ -96,7 +96,7 @@ class BibleOSISImpl():
|
|||||||
testament = 1
|
testament = 1
|
||||||
for file_record in osis.readlines():
|
for file_record in osis.readlines():
|
||||||
# cancel pressed on UI
|
# cancel pressed on UI
|
||||||
if self.loadbible == False:
|
if not self.loadbible:
|
||||||
break
|
break
|
||||||
pos = file_record.find(verseText)
|
pos = file_record.find(verseText)
|
||||||
# we have a verse
|
# we have a verse
|
||||||
|
@ -76,7 +76,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.ListView.setIconSize(QtCore.QSize(88,50))
|
self.ListView.setIconSize(QtCore.QSize(88,50))
|
||||||
self.servicePath = os.path.join(
|
self.servicePath = os.path.join(
|
||||||
self.parent.config.get_data_path(), u'.thumbnails')
|
self.parent.config.get_data_path(), u'.thumbnails')
|
||||||
if os.path.exists(self.servicePath) == False:
|
if not os.path.exists(self.servicePath):
|
||||||
os.mkdir(self.servicePath)
|
os.mkdir(self.servicePath)
|
||||||
self.loadList(self.parent.config.load_list(self.ConfigSection))
|
self.loadList(self.parent.config.load_list(self.ConfigSection))
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(self.servicePath, unicode(item.text())))
|
os.remove(os.path.join(self.servicePath, unicode(item.text())))
|
||||||
except:
|
except:
|
||||||
@ -141,8 +141,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def generateSlideData(self, service_item):
|
def generateSlideData(self, service_item):
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
if len(items) == 0:
|
if items:
|
||||||
return False
|
|
||||||
service_item.title = self.trUtf8(u'Image(s)')
|
service_item.title = self.trUtf8(u'Image(s)')
|
||||||
for item in items:
|
for item in items:
|
||||||
bitem = self.ListView.item(item.row())
|
bitem = self.ListView.item(item.row())
|
||||||
@ -151,6 +150,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
service_item.add_from_image(path, name, frame)
|
service_item.add_from_image(path, name, frame)
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def toggleOverrideState(self):
|
def toggleOverrideState(self):
|
||||||
self.overrideActive = not self.overrideActive
|
self.overrideActive = not self.overrideActive
|
||||||
|
Loading…
Reference in New Issue
Block a user