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