From 9b5f844afab06b5d17802ff060128b55d459fe6f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 6 Aug 2009 18:43:53 +0100 Subject: [PATCH 1/5] Standardize row hight in renderer Various theme fixes and cleanups --- openlp/core/lib/renderer.py | 74 +------------------------------- openlp/core/ui/servicemanager.py | 26 ++++++++--- openlp/core/ui/thememanager.py | 54 +++++++++++++++-------- openlp/core/ui/themestab.py | 12 +++--- 4 files changed, 63 insertions(+), 103 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index c24ee07b4..068753a81 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -154,11 +154,6 @@ class Renderer(object): text.append(line) #print text split_text = self.pre_render_text(text) -# print "-----------------------------" -# print split_text -# split_text = self._split_set_of_lines(text, False) -# print "-----------------------------" -# print split_text log.debug(u'format_slide - End') return split_text @@ -168,7 +163,7 @@ class Renderer(object): line_width = self._rect.width() - self._right_margin #number of lines on a page - adjust for rounding up. #print self._rect.height() , metrics.height(), int(self._rect.height() / metrics.height()) - page_length = int(self._rect.height() / metrics.height()) - 1 + page_length = int(self._rect.height() / metrics.height() - 2 ) - 1 ave_line_width = line_width / metrics.averageCharWidth() # print "A", ave_line_width ave_line_width = int(ave_line_width + (ave_line_width * 0.5)) @@ -312,73 +307,6 @@ class Renderer(object): QtCore.Qt.SmoothTransformation) log.debug(u'render background End') -# def _split_set_of_lines(self, lines, footer): -# """ -# Given a list of lines, decide how to split them best if they don't all -# fit on the screen. This is done by splitting at 1/2, 1/3 or 1/4 of the -# set. If it doesn't fit, even at this size, just split at each -# opportunity. We'll do this by getting the bounding box of each line, -# and then summing them appropriately. -# -# Returns a list of [lists of lines], one set for each screenful. -# -# ``lines`` -# The lines of text to split. -# -# ``footer`` -# The footer text. -# """ -# bboxes = [] -# for line in lines: -# bboxes.append(self._render_and_wrap_single_line(line, footer)) -# numlines = len(lines) -# bottom = self._rect.bottom() -# for ratio in (numlines, numlines/2, numlines/3, numlines/4): -# good = 1 -# startline = 0 -# endline = startline + ratio -# while (endline <= numlines and endline != 0): -# by = 0 -# for (x,y) in bboxes[startline:endline]: -# by += y -# if by > bottom: -# good = 0 -# break -# startline += ratio -# endline = startline + ratio -# if good == 1: -# break -# retval = [] -# numlines_per_page = ratio -# if good: -# c = 0 -# thislines = [] -# while c < numlines: -# thislines.append(lines[c]) -# c += 1 -# if len(thislines) == numlines_per_page: -# retval.append(thislines) -# thislines = [] -# if len(thislines) > 0: -# retval.append(thislines) -# else: -# # print "Just split where you can" -# retval = [] -# startline = 0 -# endline = startline + 1 -# while (endline <= numlines): -# by = 0 -# for (x,y) in bboxes[startline:endline]: -# by += y -# if by > bottom: -# retval.append(lines[startline:endline-1]) -# startline = endline-1 -# # gets incremented below -# endline = startline -# by = 0 -# endline += 1 -# return retval - def _correctAlignment(self, rect, bbox): """ Corrects the vertical alignment of text. diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e19d364f4..9f8f03959 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -161,7 +161,7 @@ class ServiceManager(QtGui.QWidget): # Last little bits of setting up self.config = PluginConfig(u'ServiceManager') self.servicePath = self.config.get_data_path() - self.service_theme = self.config.get_config(u'theme service theme', u'') + self.service_theme = unicode(self.config.get_config(u'theme service theme', u'')) def onMoveSelectionUp(self): """ @@ -412,7 +412,11 @@ class ServiceManager(QtGui.QWidget): def addServiceItem(self, item): """ - Add an item to the list + Add a Service item to the list + + ``item`` + Service Item to be added + """ self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1, u'expanded':True}) treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList) @@ -465,13 +469,21 @@ class ServiceManager(QtGui.QWidget): def dragEnterEvent(self, event): """ Accept Drag events + + ``event`` + Handle of the event pint passed + """ event.accept() def dropEvent(self, event): """ - Handle the release of the event and trigger the plugin - to add the data + Receive drop event and trigger an internal event to get the + plugins to build and push the correct service item + The drag event payload carries the plugin name + + ``event`` + Handle of the event pint passed """ link = event.mimeData() if link.hasText(): @@ -481,12 +493,16 @@ class ServiceManager(QtGui.QWidget): def updateThemeList(self, theme_list): """ Called from ThemeManager when the Themes have changed + + ``theme_list`` + A list of current themes to be displayed + """ self.ThemeComboBox.clear() self.ThemeComboBox.addItem(u'') for theme in theme_list: self.ThemeComboBox.addItem(theme) - id = self.ThemeComboBox.findText(unicode(self.service_theme), QtCore.Qt.MatchExactly) + id = self.ThemeComboBox.findText(self.service_theme, QtCore.Qt.MatchExactly) # Not Found if id == -1: id = 0 diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index f14a2fabc..9b809ee66 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.ui import AmendThemeForm, ServiceManager from openlp.core.theme import Theme -from openlp.core.lib import Event, EventType, EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, file_to_xml, buildIcon +from openlp.core.lib import PluginConfig, Event, EventType, EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, file_to_xml, buildIcon from openlp.core.utils import ConfigHelper class ThemeManager(QtGui.QWidget): @@ -72,6 +72,10 @@ class ThemeManager(QtGui.QWidget): self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') self.checkThemesExists(self.path) self.amendThemeForm.path = self.path + # Last little bits of setting up + self.config = PluginConfig(u'themes') + self.servicePath = self.config.get_data_path() + self.global_theme = unicode(self.config.get_config(u'theme global theme', u'')) def onAddTheme(self): self.amendThemeForm.loadTheme(None) @@ -84,26 +88,32 @@ class ThemeManager(QtGui.QWidget): self.amendThemeForm.exec_() def onDeleteTheme(self): + self.global_theme = unicode(self.config.get_config(u'theme global theme', u'')) item = self.ThemeListWidget.currentItem() if item is not None: theme = unicode(item.text()) - th = theme + u'.png' - row = self.ThemeListWidget.row(item) - self.ThemeListWidget.takeItem(row) - try: - os.remove(os.path.join(self.path, th)) - except: - #if not present do not worry - pass - try: - shutil.rmtree(os.path.join(self.path, theme)) - except: - #if not present do not worry - pass - #As we do not reload the themes push out the change - self.parent.EventManager.post_event(Event(EventType.ThemeListChanged)) - self.parent.ServiceManagerContents.updateThemeList(self.getThemes()) - self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes()) + if theme == self.global_theme: + QtGui.QMessageBox.critical(self, + translate(u'ThemeManager', u'Error'), + translate(u'ThemeManager', u'You are unable to delete the default theme!'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + else: + th = theme + u'.png' + row = self.ThemeListWidget.row(item) + self.ThemeListWidget.takeItem(row) + try: + os.remove(os.path.join(self.path, th)) + except: + #if not present do not worry + pass + try: + shutil.rmtree(os.path.join(self.path, theme)) + except: + #if not present do not worry + pass + #As we do not reload the themes push out the change + #Reaload the list as the internal lists and events need to be triggered + self.loadThemes() def onExportTheme(self): pass @@ -211,6 +221,9 @@ class ThemeManager(QtGui.QWidget): self.generateAndSaveImage(dir, themename, filexml) def checkVersion1(self, xmlfile): + """ + Am I a version 1 theme + """ log.debug(u'checkVersion1 ') theme = xmlfile tree = ElementTree(element=XML(theme)).getroot() @@ -220,6 +233,11 @@ class ThemeManager(QtGui.QWidget): return True def migrateVersion122(self, filename, fullpath, xml_data): + """ + Called by convert the xml data from version 1 format + to the current format. + New fields are defaulted but the new theme is useable + """ log.debug(u'migrateVersion122 %s %s', filename, fullpath) theme = Theme(xml_data) newtheme = ThemeXML() diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 622a0ba4b..3e33a3808 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -99,8 +99,6 @@ class ThemesTab(SettingsTab): QtCore.QObject.connect(self.DefaultComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged) - #self.DefaultListView.setScaledContents(True) - def retranslateUi(self): self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme')) self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level')) @@ -138,9 +136,9 @@ class ThemesTab(SettingsTab): self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style) def onDefaultComboBoxChanged(self, value): - self.global_theme = self.DefaultComboBox.currentText() + self.global_theme = unicode(self.DefaultComboBox.currentText()) self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style) - image = self.parent.ThemeManagerContents.getPreviewImage(unicode(self.global_theme)) + image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme) preview = QtGui.QPixmap(unicode(image)) display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) self.DefaultListView.setPixmap(display) @@ -152,14 +150,14 @@ class ThemesTab(SettingsTab): self.DefaultComboBox.clear() for theme in theme_list: self.DefaultComboBox.addItem(theme) - id = self.DefaultComboBox.findText(unicode(self.global_theme), QtCore.Qt.MatchExactly) + id = self.DefaultComboBox.findText(self.global_theme, QtCore.Qt.MatchExactly) if id == -1: id = 0 # Not Found self.global_theme = u'' self.DefaultComboBox.setCurrentIndex(id) self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style) if self.global_theme is not u'': - image = self.parent.ThemeManagerContents.getPreviewImage(unicode(self.global_theme)) + image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme) preview = QtGui.QPixmap(unicode(image)) display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(display) \ No newline at end of file + self.DefaultListView.setPixmap(display) From 06ff5ec618307e23e377b3ca964d5f2689cb11bc Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 7 Aug 2009 18:19:32 +0100 Subject: [PATCH 2/5] New bible import form Start of default theme handling Add Transparent backgrounds --- openlp/core/lib/renderer.py | 73 +-- openlp/core/lib/themexmlhandler.py | 5 + openlp/core/ui/amendthemeform.py | 21 +- openlp/core/ui/thememanager.py | 9 +- .../plugins/bibles/forms/bibleimportdialog.py | 310 +++++----- resources/forms/bibleimportdialog.ui | 576 +++++++++--------- 6 files changed, 503 insertions(+), 491 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 068753a81..55c484d5e 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -267,41 +267,44 @@ class Renderer(object): log.debug(u'render background %s start', self._theme.background_type) painter = QtGui.QPainter() painter.begin(self._bg_frame) - if self._theme.background_type == u'solid': - painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color)) - elif self._theme.background_type == u'gradient': - # gradient - gradient = None - if self._theme.background_direction == u'horizontal': - w = int(self._frame.width()) / 2 - # vertical - gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height()) - elif self._theme.background_direction == u'vertical': - h = int(self._frame.height()) / 2 - # Horizontal - gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h) - else: - w = int(self._frame.width()) / 2 - h = int(self._frame.height()) / 2 - # Circular - gradient = QtGui.QRadialGradient(w, h, w) - gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor)) - gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor)) - painter.setBrush(QtGui.QBrush(gradient)) - rectPath = QtGui.QPainterPath() - max_x = self._frame.width() - max_y = self._frame.height() - rectPath.moveTo(0, 0) - rectPath.lineTo(0, max_y) - rectPath.lineTo(max_x, max_y) - rectPath.lineTo(max_x, 0) - rectPath.closeSubpath() - painter.drawPath(rectPath) - elif self._theme.background_type== u'image': - # image - painter.fillRect(self._frame.rect(), QtCore.Qt.black) - if self.bg_image is not None: - painter.drawImage(0 ,0 , self.bg_image) + if self._theme.background_mode == u'transparent': + painter.fillRect(self._frame.rect(), QtCore.Qt.transparent) + else: + if self._theme.background_type == u'solid': + painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color)) + elif self._theme.background_type == u'gradient': + # gradient + gradient = None + if self._theme.background_direction == u'horizontal': + w = int(self._frame.width()) / 2 + # vertical + gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height()) + elif self._theme.background_direction == u'vertical': + h = int(self._frame.height()) / 2 + # Horizontal + gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h) + else: + w = int(self._frame.width()) / 2 + h = int(self._frame.height()) / 2 + # Circular + gradient = QtGui.QRadialGradient(w, h, w) + gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor)) + gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor)) + painter.setBrush(QtGui.QBrush(gradient)) + rectPath = QtGui.QPainterPath() + max_x = self._frame.width() + max_y = self._frame.height() + rectPath.moveTo(0, 0) + rectPath.lineTo(0, max_y) + rectPath.lineTo(max_x, max_y) + rectPath.lineTo(max_x, 0) + rectPath.closeSubpath() + painter.drawPath(rectPath) + elif self._theme.background_type== u'image': + # image + painter.fillRect(self._frame.rect(), QtCore.Qt.black) + if self.bg_image is not None: + painter.drawImage(0 ,0 , self.bg_image) painter.end() self._bg_frame_small = self._bg_frame.scaled(QtCore.QSize(280, 210), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index accd9cf53..73fe78d66 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -331,6 +331,11 @@ class ThemeXML(object): for element in iter: if len(element.getchildren()) > 0: master = element.tag + u'_' + else: + #background transparent tags have no children so special case + if element.tag == u'background': + for e in element.attrib.iteritems(): + setattr(self, element.tag + u'_' + e[0], e[1]) if len(element.attrib) > 0: for e in element.attrib.iteritems(): if master == u'font_' and e[0] == u'type': diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index f22c9212a..ef6f8368f 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -108,16 +108,19 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): new_theme.new_document(theme_name) save_from = None save_to = None - if self.theme.background_type == u'solid': - new_theme.add_background_solid(unicode(self.theme.background_color)) - elif self.theme.background_type == u'gradient': - new_theme.add_background_gradient(unicode(self.theme.background_startColor), - unicode(self.theme.background_endColor), self.theme.background_direction) + if self.theme.background_mode == u'transparent': + new_theme.add_background_transparent() else: - (path, filename) =os.path.split(unicode(self.theme.background_filename)) - new_theme.add_background_image(filename) - save_to= os.path.join(self.path, theme_name, filename ) - save_from = self.theme.background_filename + if self.theme.background_type == u'solid': + new_theme.add_background_solid(unicode(self.theme.background_color)) + elif self.theme.background_type == u'gradient': + new_theme.add_background_gradient(unicode(self.theme.background_startColor), + unicode(self.theme.background_endColor), self.theme.background_direction) + else: + (path, filename) =os.path.split(unicode(self.theme.background_filename)) + new_theme.add_background_image(filename) + save_to= os.path.join(self.path, theme_name, filename ) + save_from = self.theme.background_filename new_theme.add_font(unicode(self.theme.font_main_name), unicode(self.theme.font_main_color), unicode(self.theme.font_main_proportion), unicode(self.theme.font_main_override), u'main', diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 9b809ee66..765e25c96 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -146,7 +146,11 @@ class ThemeManager(QtGui.QWidget): if os.path.exists(theme): (path, filename) = os.path.split(unicode(file)) textName = os.path.splitext(name)[0] - item_name = QtGui.QListWidgetItem(textName) + if textName == self.global_theme: + name = (u'(%s):%s' % (translate(u'ThemeManager', u'default'), textName)) + else: + name = textName + item_name = QtGui.QListWidgetItem(name) item_name.setIcon(buildIcon(theme)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(textName)) self.ThemeListWidget.addItem(item_name) @@ -163,6 +167,7 @@ class ThemeManager(QtGui.QWidget): xml_file = os.path.join(self.path, unicode(themename), unicode(themename) + u'.xml') try: xml = file_to_xml(xml_file) + #print xml except: newtheme = ThemeXML() newtheme.new_document(u'New Theme') @@ -173,7 +178,9 @@ class ThemeManager(QtGui.QWidget): unicode(0), unicode(0), unicode(0)) xml = newtheme.extract_xml() theme = ThemeXML() + #print theme theme.parse(xml) + #print "A ", theme theme.extend_image_filename(self.path) return theme diff --git a/openlp/plugins/bibles/forms/bibleimportdialog.py b/openlp/plugins/bibles/forms/bibleimportdialog.py index 591178acd..8a8ec16a3 100644 --- a/openlp/plugins/bibles/forms/bibleimportdialog.py +++ b/openlp/plugins/bibles/forms/bibleimportdialog.py @@ -2,140 +2,22 @@ # Form implementation generated from reading ui file 'bibleimportdialog.ui' # -# Created: Fri Feb 20 05:45:22 2009 +# Created: Fri Aug 7 06:07:06 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate class Ui_BibleImportDialog(object): def setupUi(self, BibleImportDialog): BibleImportDialog.setObjectName(u'BibleImportDialog') - BibleImportDialog.resize(494, 725) + BibleImportDialog.resize(500, 686) icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off) BibleImportDialog.setWindowIcon(icon) - self.ImportToolBox = QtGui.QToolBox(BibleImportDialog) - self.ImportToolBox.setGeometry(QtCore.QRect(20, 20, 451, 401)) - self.ImportToolBox.setFrameShape(QtGui.QFrame.StyledPanel) - self.ImportToolBox.setObjectName(u'ImportToolBox') - self.FileImportPage = QtGui.QWidget() - self.FileImportPage.setGeometry(QtCore.QRect(0, 0, 447, 337)) - self.FileImportPage.setObjectName(u'FileImportPage') - self.OSISGroupBox = QtGui.QGroupBox(self.FileImportPage) - self.OSISGroupBox.setGeometry(QtCore.QRect(18, 65, 411, 81)) - self.OSISGroupBox.setObjectName(u'OSISGroupBox') - self.gridLayout_2 = QtGui.QGridLayout(self.OSISGroupBox) - self.gridLayout_2.setMargin(8) - self.gridLayout_2.setSpacing(8) - self.gridLayout_2.setObjectName(u'gridLayout_2') - self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox) - self.LocatioLabel.setObjectName(u'LocatioLabel') - self.gridLayout_2.addWidget(self.LocatioLabel, 0, 0, 1, 1) - self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox) - self.OSISLocationEdit.setObjectName(u'OSISLocationEdit') - self.gridLayout_2.addWidget(self.OSISLocationEdit, 0, 1, 1, 1) - self.OsisFileButton = QtGui.QPushButton(self.OSISGroupBox) - icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.OsisFileButton.setIcon(icon1) - self.OsisFileButton.setObjectName(u'OsisFileButton') - self.gridLayout_2.addWidget(self.OsisFileButton, 0, 2, 1, 1) - self.CVSGroupBox = QtGui.QGroupBox(self.FileImportPage) - self.CVSGroupBox.setGeometry(QtCore.QRect(20, 170, 411, 191)) - self.CVSGroupBox.setObjectName(u'CVSGroupBox') - self.gridLayout = QtGui.QGridLayout(self.CVSGroupBox) - self.gridLayout.setMargin(8) - self.gridLayout.setSpacing(8) - self.gridLayout.setObjectName(u'gridLayout') - self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox) - self.BooksLocationLabel.setObjectName(u'BooksLocationLabel') - self.gridLayout.addWidget(self.BooksLocationLabel, 0, 0, 1, 1) - self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox) - self.VerseLocationLabel.setObjectName(u'VerseLocationLabel') - self.gridLayout.addWidget(self.VerseLocationLabel, 4, 0, 1, 1) - self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) - self.VerseLocationEdit.setObjectName(u'VerseLocationEdit') - self.gridLayout.addWidget(self.VerseLocationEdit, 4, 1, 1, 1) - self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) - self.BooksLocationEdit.setObjectName(u'BooksLocationEdit') - self.gridLayout.addWidget(self.BooksLocationEdit, 0, 1, 1, 1) - self.BooksFileButton = QtGui.QPushButton(self.CVSGroupBox) - self.BooksFileButton.setIcon(icon1) - self.BooksFileButton.setObjectName(u'BooksFileButton') - self.gridLayout.addWidget(self.BooksFileButton, 0, 2, 1, 1) - self.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox) - self.VersesFileButton.setIcon(icon1) - self.VersesFileButton.setObjectName(u'VersesFileButton') - self.gridLayout.addWidget(self.VersesFileButton, 4, 2, 1, 1) - self.BibleNameEdit = QtGui.QLineEdit(self.FileImportPage) - self.BibleNameEdit.setGeometry(QtCore.QRect(100, 20, 280, 28)) - self.BibleNameEdit.setObjectName(u'BibleNameEdit') - self.BibleNameLabel = QtGui.QLabel(self.FileImportPage) - self.BibleNameLabel.setGeometry(QtCore.QRect(18, 20, 98, 22)) - self.BibleNameLabel.setObjectName(u'BibleNameLabel') - self.ImportToolBox.addItem(self.FileImportPage, u'') - self.WebBiblePage = QtGui.QWidget() - self.WebBiblePage.setGeometry(QtCore.QRect(0, 0, 447, 337)) - self.WebBiblePage.setObjectName(u'WebBiblePage') - self.WebBibleLayout = QtGui.QVBoxLayout(self.WebBiblePage) - self.WebBibleLayout.setSpacing(8) - self.WebBibleLayout.setMargin(8) - self.WebBibleLayout.setObjectName(u'WebBibleLayout') - self.OptionsGroupBox = QtGui.QGroupBox(self.WebBiblePage) - self.OptionsGroupBox.setObjectName(u'OptionsGroupBox') - self.formLayout_2 = QtGui.QFormLayout(self.OptionsGroupBox) - self.formLayout_2.setObjectName(u'formLayout_2') - self.LocationLabel = QtGui.QLabel(self.OptionsGroupBox) - self.LocationLabel.setObjectName(u'LocationLabel') - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.LocationLabel) - self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox) - self.LocationComboBox.setObjectName(u'LocationComboBox') - self.LocationComboBox.addItem(QtCore.QString()) - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.LocationComboBox) - self.BibleLabel = QtGui.QLabel(self.OptionsGroupBox) - self.BibleLabel.setObjectName(u'BibleLabel') - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.BibleLabel) - self.BibleComboBox = QtGui.QComboBox(self.OptionsGroupBox) - self.BibleComboBox.setObjectName(u'BibleComboBox') - self.BibleComboBox.addItem(QtCore.QString()) - self.BibleComboBox.setItemText(0, u'') - self.BibleComboBox.addItem(QtCore.QString()) - self.BibleComboBox.addItem(QtCore.QString()) - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.BibleComboBox) - self.WebBibleLayout.addWidget(self.OptionsGroupBox) - self.ProxyGroupBox = QtGui.QGroupBox(self.WebBiblePage) - self.ProxyGroupBox.setObjectName(u'ProxyGroupBox') - self.ProxySettingsLayout = QtGui.QFormLayout(self.ProxyGroupBox) - self.ProxySettingsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.ProxySettingsLayout.setMargin(8) - self.ProxySettingsLayout.setSpacing(8) - self.ProxySettingsLayout.setObjectName(u'ProxySettingsLayout') - self.AddressLabel = QtGui.QLabel(self.ProxyGroupBox) - self.AddressLabel.setObjectName(u'AddressLabel') - self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel) - self.AddressEdit = QtGui.QLineEdit(self.ProxyGroupBox) - self.AddressEdit.setObjectName(u'AddressEdit') - self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit) - self.UsernameLabel = QtGui.QLabel(self.ProxyGroupBox) - self.UsernameLabel.setObjectName(u'UsernameLabel') - self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel) - self.UsernameEdit = QtGui.QLineEdit(self.ProxyGroupBox) - self.UsernameEdit.setObjectName(u'UsernameEdit') - self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit) - self.PasswordLabel = QtGui.QLabel(self.ProxyGroupBox) - self.PasswordLabel.setObjectName(u'PasswordLabel') - self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel) - self.PasswordEdit = QtGui.QLineEdit(self.ProxyGroupBox) - self.PasswordEdit.setEchoMode(QtGui.QLineEdit.Password) - self.PasswordEdit.setObjectName(u'PasswordEdit') - self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit) - self.WebBibleLayout.addWidget(self.ProxyGroupBox) - self.ImportToolBox.addItem(self.WebBiblePage, u'') self.LicenceDetailsGroupBox = QtGui.QGroupBox(BibleImportDialog) - self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(10, 435, 471, 151)) + self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(10, 400, 480, 151)) self.LicenceDetailsGroupBox.setMinimumSize(QtCore.QSize(0, 123)) self.LicenceDetailsGroupBox.setObjectName(u'LicenceDetailsGroupBox') self.formLayout = QtGui.QFormLayout(self.LicenceDetailsGroupBox) @@ -164,7 +46,7 @@ class Ui_BibleImportDialog(object): self.MessageLabel.setGeometry(QtCore.QRect(20, 670, 271, 17)) self.MessageLabel.setObjectName(u'MessageLabel') self.ProgressGroupBox = QtGui.QGroupBox(BibleImportDialog) - self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 600, 471, 70)) + self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 550, 480, 70)) self.ProgressGroupBox.setObjectName(u'ProgressGroupBox') self.gridLayout_3 = QtGui.QGridLayout(self.ProgressGroupBox) self.gridLayout_3.setObjectName(u'gridLayout_3') @@ -174,7 +56,7 @@ class Ui_BibleImportDialog(object): self.ProgressBar.setObjectName(u'ProgressBar') self.gridLayout_3.addWidget(self.ProgressBar, 0, 0, 1, 1) self.layoutWidget = QtGui.QWidget(BibleImportDialog) - self.layoutWidget.setGeometry(QtCore.QRect(300, 680, 180, 38)) + self.layoutWidget.setGeometry(QtCore.QRect(310, 630, 180, 38)) self.layoutWidget.setObjectName(u'layoutWidget') self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget) self.horizontalLayout.setMargin(6) @@ -185,10 +67,131 @@ class Ui_BibleImportDialog(object): self.CancelButton = QtGui.QPushButton(self.layoutWidget) self.CancelButton.setObjectName(u'CancelButton') self.horizontalLayout.addWidget(self.CancelButton) + self.tabWidget = QtGui.QTabWidget(BibleImportDialog) + self.tabWidget.setGeometry(QtCore.QRect(10, 30, 480, 361)) + self.tabWidget.setObjectName(u'tabWidget') + self.OsisTab = QtGui.QWidget() + self.OsisTab.setObjectName(u'OsisTab') + self.OSISGroupBox = QtGui.QGroupBox(self.OsisTab) + self.OSISGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 141)) + self.OSISGroupBox.setObjectName(u'OSISGroupBox') + self.gridLayout_2 = QtGui.QGridLayout(self.OSISGroupBox) + self.gridLayout_2.setObjectName(u'gridLayout_2') + self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') + self.BibleNameLabel = QtGui.QLabel(self.OSISGroupBox) + self.BibleNameLabel.setObjectName(u'BibleNameLabel') + self.horizontalLayout_2.addWidget(self.BibleNameLabel) + self.BibleNameEdit = QtGui.QLineEdit(self.OSISGroupBox) + self.BibleNameEdit.setObjectName(u'BibleNameEdit') + self.horizontalLayout_2.addWidget(self.BibleNameEdit) + self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) + self.horizontalLayout_3 = QtGui.QHBoxLayout() + self.horizontalLayout_3.setObjectName(u'horizontalLayout_3') + self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox) + self.LocatioLabel.setObjectName(u'LocatioLabel') + self.horizontalLayout_3.addWidget(self.LocatioLabel) + self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox) + self.OSISLocationEdit.setObjectName(u'OSISLocationEdit') + self.horizontalLayout_3.addWidget(self.OSISLocationEdit) + self.OsisFileButton = QtGui.QPushButton(self.OSISGroupBox) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.OsisFileButton.setIcon(icon1) + self.OsisFileButton.setObjectName(u'OsisFileButton') + self.horizontalLayout_3.addWidget(self.OsisFileButton) + self.gridLayout_2.addLayout(self.horizontalLayout_3, 1, 0, 1, 1) + self.tabWidget.addTab(self.OsisTab, u'') + self.CsvTab = QtGui.QWidget() + self.CsvTab.setObjectName(u'CsvTab') + self.CVSGroupBox = QtGui.QGroupBox(self.CsvTab) + self.CVSGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 191)) + self.CVSGroupBox.setObjectName(u'CVSGroupBox') + self.gridLayout = QtGui.QGridLayout(self.CVSGroupBox) + self.gridLayout.setMargin(8) + self.gridLayout.setSpacing(8) + self.gridLayout.setObjectName(u'gridLayout') + self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox) + self.BooksLocationLabel.setObjectName(u'BooksLocationLabel') + self.gridLayout.addWidget(self.BooksLocationLabel, 0, 0, 1, 1) + self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox) + self.VerseLocationLabel.setObjectName(u'VerseLocationLabel') + self.gridLayout.addWidget(self.VerseLocationLabel, 4, 0, 1, 1) + self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) + self.VerseLocationEdit.setObjectName(u'VerseLocationEdit') + self.gridLayout.addWidget(self.VerseLocationEdit, 4, 1, 1, 1) + self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) + self.BooksLocationEdit.setObjectName(u'BooksLocationEdit') + self.gridLayout.addWidget(self.BooksLocationEdit, 0, 1, 1, 1) + self.BooksFileButton = QtGui.QPushButton(self.CVSGroupBox) + self.BooksFileButton.setIcon(icon1) + self.BooksFileButton.setObjectName(u'BooksFileButton') + self.gridLayout.addWidget(self.BooksFileButton, 0, 2, 1, 1) + self.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox) + self.VersesFileButton.setIcon(icon1) + self.VersesFileButton.setObjectName(u'VersesFileButton') + self.gridLayout.addWidget(self.VersesFileButton, 4, 2, 1, 1) + self.tabWidget.addTab(self.CsvTab, u'') + self.HttpTab = QtGui.QWidget() + self.HttpTab.setObjectName(u'HttpTab') + self.OptionsGroupBox = QtGui.QGroupBox(self.HttpTab) + self.OptionsGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 141)) + self.OptionsGroupBox.setObjectName(u'OptionsGroupBox') + self.verticalLayout = QtGui.QVBoxLayout(self.OptionsGroupBox) + self.verticalLayout.setObjectName(u'verticalLayout') + self.horizontalLayout_4 = QtGui.QHBoxLayout() + self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') + self.LocationLabel = QtGui.QLabel(self.OptionsGroupBox) + self.LocationLabel.setObjectName(u'LocationLabel') + self.horizontalLayout_4.addWidget(self.LocationLabel) + self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox) + self.LocationComboBox.setObjectName(u'LocationComboBox') + self.LocationComboBox.addItem(QtCore.QString()) + self.horizontalLayout_4.addWidget(self.LocationComboBox) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.horizontalLayout_5 = QtGui.QHBoxLayout() + self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') + self.BibleLabel = QtGui.QLabel(self.OptionsGroupBox) + self.BibleLabel.setObjectName(u'BibleLabel') + self.horizontalLayout_5.addWidget(self.BibleLabel) + self.BibleComboBox = QtGui.QComboBox(self.OptionsGroupBox) + self.BibleComboBox.setObjectName(u'BibleComboBox') + self.BibleComboBox.addItem(QtCore.QString()) + self.BibleComboBox.setItemText(0, u'') + self.BibleComboBox.addItem(QtCore.QString()) + self.BibleComboBox.addItem(QtCore.QString()) + self.horizontalLayout_5.addWidget(self.BibleComboBox) + self.verticalLayout.addLayout(self.horizontalLayout_5) + self.ProxyGroupBox = QtGui.QGroupBox(self.HttpTab) + self.ProxyGroupBox.setGeometry(QtCore.QRect(10, 160, 460, 161)) + self.ProxyGroupBox.setObjectName(u'ProxyGroupBox') + self.ProxySettingsLayout = QtGui.QFormLayout(self.ProxyGroupBox) + self.ProxySettingsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.ProxySettingsLayout.setMargin(8) + self.ProxySettingsLayout.setSpacing(8) + self.ProxySettingsLayout.setObjectName(u'ProxySettingsLayout') + self.AddressLabel = QtGui.QLabel(self.ProxyGroupBox) + self.AddressLabel.setObjectName(u'AddressLabel') + self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel) + self.AddressEdit = QtGui.QLineEdit(self.ProxyGroupBox) + self.AddressEdit.setObjectName(u'AddressEdit') + self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit) + self.UsernameLabel = QtGui.QLabel(self.ProxyGroupBox) + self.UsernameLabel.setObjectName(u'UsernameLabel') + self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel) + self.UsernameEdit = QtGui.QLineEdit(self.ProxyGroupBox) + self.UsernameEdit.setObjectName(u'UsernameEdit') + self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit) + self.PasswordLabel = QtGui.QLabel(self.ProxyGroupBox) + self.PasswordLabel.setObjectName(u'PasswordLabel') + self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel) + self.PasswordEdit = QtGui.QLineEdit(self.ProxyGroupBox) + self.PasswordEdit.setObjectName(u'PasswordEdit') + self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit) + self.tabWidget.addTab(self.HttpTab, u'') self.retranslateUi(BibleImportDialog) - self.ImportToolBox.setCurrentIndex(1) - + self.tabWidget.setCurrentIndex(2) QtCore.QMetaObject.connectSlotsByName(BibleImportDialog) BibleImportDialog.setTabOrder(self.BibleNameEdit, self.OSISLocationEdit) BibleImportDialog.setTabOrder(self.OSISLocationEdit, self.OsisFileButton) @@ -206,30 +209,31 @@ class Ui_BibleImportDialog(object): BibleImportDialog.setTabOrder(self.CopyrightEdit, self.PermisionEdit) def retranslateUi(self, BibleImportDialog): - BibleImportDialog.setWindowTitle(translate(u'BibleImportDialog', u'Bible Registration')) - self.OSISGroupBox.setTitle(translate(u'BibleImportDialog', u'OSIS Bible')) - self.LocatioLabel.setText(translate(u'BibleImportDialog', u'File Location:')) - self.CVSGroupBox.setTitle(translate(u'BibleImportDialog', u'CVS Bible')) - self.BooksLocationLabel.setText(translate(u'BibleImportDialog', u'Books Location:')) - self.VerseLocationLabel.setText(translate(u'BibleImportDialog', u'Verse Location:')) - self.BibleNameLabel.setText(translate(u'BibleImportDialog', u'Bible Name:')) - self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.FileImportPage), translate(u'BibleImportDialog', u'File Import Page')) - self.OptionsGroupBox.setTitle(translate(u'BibleImportDialog', u'Download Options')) - self.LocationLabel.setText(translate(u'BibleImportDialog', u'Location:')) - self.LocationComboBox.setItemText(0, translate(u'BibleImportDialog', u'Crosswalk')) - self.BibleLabel.setText(translate(u'BibleImportDialog', u'Bible:')) - self.BibleComboBox.setItemText(1, translate(u'BibleImportDialog', u'NIV')) - self.BibleComboBox.setItemText(2, translate(u'BibleImportDialog', u'KJV')) - self.ProxyGroupBox.setTitle(translate(u'BibleImportDialog', u'Proxy Settings (Optional)')) - self.AddressLabel.setText(translate(u'BibleImportDialog', u'Proxy Address:')) - self.UsernameLabel.setText(translate(u'BibleImportDialog', u'Username:')) - self.PasswordLabel.setText(translate(u'BibleImportDialog', u'Password:')) - self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.WebBiblePage), translate(u'BibleImportDialog', u'Web Bible Import page')) - self.LicenceDetailsGroupBox.setTitle(translate(u'BibleImportDialog', u'Licence Details')) - self.VersionNameLabel.setText(translate(u'BibleImportDialog', u'Version Name:')) - self.CopyrightLabel.setText(translate(u'BibleImportDialog', u'Copyright:')) - self.PermisionLabel.setText(translate(u'BibleImportDialog', u'Permission:')) - self.ProgressGroupBox.setTitle(translate(u'BibleImportDialog', u'Import Progress')) - self.ProgressBar.setFormat(translate(u'BibleImportDialog', u'%p')) - self.ImportButton.setText(translate(u'BibleImportDialog', u'Import')) - self.CancelButton.setText(translate(u'BibleImportDialog', u'Cancel')) + BibleImportDialog.setWindowTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Registration', None, QtGui.QApplication.UnicodeUTF8)) + self.LicenceDetailsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Licence Details', None, QtGui.QApplication.UnicodeUTF8)) + self.VersionNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Version Name:', None, QtGui.QApplication.UnicodeUTF8)) + self.CopyrightLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Copyright:', None, QtGui.QApplication.UnicodeUTF8)) + self.PermisionLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Permission:', None, QtGui.QApplication.UnicodeUTF8)) + self.ProgressGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Import Progress', None, QtGui.QApplication.UnicodeUTF8)) + self.ProgressBar.setFormat(QtGui.QApplication.translate(u'BibleImportDialog', u'%p', None, QtGui.QApplication.UnicodeUTF8)) + self.ImportButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Import', None, QtGui.QApplication.UnicodeUTF8)) + self.CancelButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Cancel', None, QtGui.QApplication.UnicodeUTF8)) + self.OSISGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'OSIS Bible', None, QtGui.QApplication.UnicodeUTF8)) + self.BibleNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Name:', None, QtGui.QApplication.UnicodeUTF8)) + self.LocatioLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'File Location:', None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.OsisTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Osis (Sword) Imports', None, QtGui.QApplication.UnicodeUTF8)) + self.CVSGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'CVS Bible', None, QtGui.QApplication.UnicodeUTF8)) + self.BooksLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Books Location:', None, QtGui.QApplication.UnicodeUTF8)) + self.VerseLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Verse Location:', None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.CsvTab), QtGui.QApplication.translate(u'BibleImportDialog', u'CSV File Imports', None, QtGui.QApplication.UnicodeUTF8)) + self.OptionsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Download Options', None, QtGui.QApplication.UnicodeUTF8)) + self.LocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Location:', None, QtGui.QApplication.UnicodeUTF8)) + self.LocationComboBox.setItemText(0, QtGui.QApplication.translate(u'BibleImportDialog', u'Crosswalk', None, QtGui.QApplication.UnicodeUTF8)) + self.BibleLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible:', None, QtGui.QApplication.UnicodeUTF8)) + self.BibleComboBox.setItemText(1, QtGui.QApplication.translate(u'BibleImportDialog', u'NIV', None, QtGui.QApplication.UnicodeUTF8)) + self.BibleComboBox.setItemText(2, QtGui.QApplication.translate(u'BibleImportDialog', u'KJV', None, QtGui.QApplication.UnicodeUTF8)) + self.ProxyGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Settings (Optional)', None, QtGui.QApplication.UnicodeUTF8)) + self.AddressLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Address:', None, QtGui.QApplication.UnicodeUTF8)) + self.UsernameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Username:', None, QtGui.QApplication.UnicodeUTF8)) + self.PasswordLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Password:', None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.HttpTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Web Downloads', None, QtGui.QApplication.UnicodeUTF8)) diff --git a/resources/forms/bibleimportdialog.ui b/resources/forms/bibleimportdialog.ui index a53e47e35..87740ec9e 100644 --- a/resources/forms/bibleimportdialog.ui +++ b/resources/forms/bibleimportdialog.ui @@ -6,307 +6,23 @@ 0 0 - 494 - 725 + 500 + 686 Bible Registration - + :/icon/openlp.org-icon-32.bmp:/icon/openlp.org-icon-32.bmp - - - - 20 - 20 - 451 - 401 - - - - QFrame::StyledPanel - - - 1 - - - - - 0 - 0 - 447 - 337 - - - - File Import Page - - - - - 18 - 65 - 411 - 81 - - - - OSIS Bible - - - - 8 - - - 8 - - - - - File Location: - - - - - - - - - - - - - - :/imports/import_load.png:/imports/import_load.png - - - - - - - - - 20 - 170 - 411 - 191 - - - - CVS Bible - - - - 8 - - - 8 - - - - - Books Location: - - - - - - - Verse Location: - - - - - - - - - - - - - - - - - :/imports/import_load.png:/imports/import_load.png - - - - - - - - - - - :/imports/import_load.png:/imports/import_load.png - - - - - - - - - 100 - 20 - 280 - 28 - - - - - - - 18 - 20 - 98 - 22 - - - - Bible Name: - - - - - - - 0 - 0 - 447 - 337 - - - - Web Bible Import page - - - - 8 - - - 8 - - - - - Download Options - - - - - - Location: - - - - - - - - Crosswalk - - - - - - - - Bible: - - - - - - - - - - - - - NIV - - - - - KJV - - - - - - BibleComboBox - LocationLabel - BibleLabel - LocationComboBox - - - - - - Proxy Settings (Optional) - - - - QFormLayout::AllNonFixedFieldsGrow - - - 8 - - - 8 - - - 8 - - - - - Proxy Address: - - - - - - - - - - Username: - - - - - - - - - - Password: - - - - - - - - - - - - 10 - 435 - 471 + 400 + 480 151 @@ -375,8 +91,8 @@ 10 - 600 - 471 + 550 + 480 70 @@ -402,8 +118,8 @@ - 300 - 680 + 310 + 630 180 38 @@ -428,6 +144,280 @@ + + + + 10 + 30 + 480 + 361 + + + + 2 + + + + Osis (Sword) Imports + + + + + 10 + 10 + 460 + 141 + + + + OSIS Bible + + + + + + + + Bible Name: + + + + + + + + + + + + + + File Location: + + + + + + + + + + + + + + :/imports/import_load.png:/imports/import_load.png + + + + + + + + + + + CSV File Imports + + + + + 10 + 10 + 460 + 191 + + + + CVS Bible + + + + 8 + + + 8 + + + + + Books Location: + + + + + + + Verse Location: + + + + + + + + + + + + + + + + + :/imports/import_load.png:/imports/import_load.png + + + + + + + + + + + :/imports/import_load.png:/imports/import_load.png + + + + + + + + + Web Downloads + + + + + 10 + 10 + 460 + 141 + + + + Download Options + + + + + + + + Location: + + + + + + + + Crosswalk + + + + + + + + + + + + Bible: + + + + + + + + + + + + + NIV + + + + + KJV + + + + + + + + BibleComboBox + LocationLabel + BibleLabel + LocationComboBox + + + + + 10 + 160 + 460 + 161 + + + + Proxy Settings (Optional) + + + + QFormLayout::AllNonFixedFieldsGrow + + + 8 + + + 8 + + + 8 + + + + + Proxy Address: + + + + + + + + + + Username: + + + + + + + + + + Password: + + + + + + + + + OptionsGroupBox + OptionsGroupBox + ProxyGroupBox + + BibleNameEdit From 23b13ede2dea658b2c58adb4fb494d2da07e79dd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 7 Aug 2009 18:30:12 +0100 Subject: [PATCH 3/5] Default handling allows editing and blocks deletes --- openlp/core/ui/thememanager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 765e25c96..e29c23d0f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -84,7 +84,7 @@ class ThemeManager(QtGui.QWidget): def onEditTheme(self): item = self.ThemeListWidget.currentItem() if item is not None: - self.amendThemeForm.loadTheme(unicode(item.text())) + self.amendThemeForm.loadTheme(unicode(item.data(QtCore.Qt.UserRole).toString())) self.amendThemeForm.exec_() def onDeleteTheme(self): @@ -92,7 +92,8 @@ class ThemeManager(QtGui.QWidget): item = self.ThemeListWidget.currentItem() if item is not None: theme = unicode(item.text()) - if theme == self.global_theme: + # should be the same unless default + if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): QtGui.QMessageBox.critical(self, translate(u'ThemeManager', u'Error'), translate(u'ThemeManager', u'You are unable to delete the default theme!'), From 26a16587241b2cb52639a9cdc11325421af64aec Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 7 Aug 2009 20:05:00 +0100 Subject: [PATCH 4/5] finish Theme handling corrections Set Global Theme back in settings tab --- openlp/core/ui/thememanager.py | 25 ++++++++++++++++++++++++- openlp/core/ui/themestab.py | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index e29c23d0f..413886d91 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -68,6 +68,10 @@ class ThemeManager(QtGui.QWidget): self.ThemeListWidget.setAlternatingRowColors(True) self.ThemeListWidget.setIconSize(QtCore.QSize(88,50)) self.Layout.addWidget(self.ThemeListWidget) + #Signals + QtCore.QObject.connect(self.ThemeListWidget, + QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobal) + #Variables self.themelist = [] self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') self.checkThemesExists(self.path) @@ -77,6 +81,21 @@ class ThemeManager(QtGui.QWidget): self.servicePath = self.config.get_data_path() self.global_theme = unicode(self.config.get_config(u'theme global theme', u'')) + def changeGlobal(self, index): + for count in range (0, self.ThemeListWidget.count()): + item = self.ThemeListWidget.item(count) + oldName = item.text() + #reset the old name + if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()): + self.ThemeListWidget.item(count).setText(unicode(item.data(QtCore.Qt.UserRole).toString())) + #Set the new name + if count == index.row(): + self.global_theme = unicode(self.ThemeListWidget.item(count).text()) + name = (u'(%s):%s' % (translate(u'ThemeManager', u'default'), self.global_theme)) + self.ThemeListWidget.item(count).setText(name) + self.config.set_config(u'theme global theme', self.global_theme) + self.push_themes() + def onAddTheme(self): self.amendThemeForm.loadTheme(None) self.amendThemeForm.exec_() @@ -99,6 +118,7 @@ class ThemeManager(QtGui.QWidget): translate(u'ThemeManager', u'You are unable to delete the default theme!'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) else: + self.themelist.remove(theme) th = theme + u'.png' row = self.ThemeListWidget.row(item) self.ThemeListWidget.takeItem(row) @@ -114,7 +134,7 @@ class ThemeManager(QtGui.QWidget): pass #As we do not reload the themes push out the change #Reaload the list as the internal lists and events need to be triggered - self.loadThemes() + self.push_themes() def onExportTheme(self): pass @@ -156,6 +176,9 @@ class ThemeManager(QtGui.QWidget): item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(textName)) self.ThemeListWidget.addItem(item_name) self.themelist.append(textName) + self.push_themes() + + def push_themes(self): self.parent.EventManager.post_event(Event(EventType.ThemeListChanged)) self.parent.ServiceManagerContents.updateThemeList(self.getThemes()) self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes()) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 3e33a3808..7b18a9917 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -147,6 +147,8 @@ class ThemesTab(SettingsTab): """ Called from ThemeManager when the Themes have changed """ + #reload as may have been triggered by the ThemeManager + self.global_theme = self.config.get_config(u'theme global theme', u'') self.DefaultComboBox.clear() for theme in theme_list: self.DefaultComboBox.addItem(theme) From 38f8005d5d680e8b7e26302e8b8f4ad5c80eca98 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 8 Aug 2009 07:19:09 +0100 Subject: [PATCH 5/5] Fix code so we can save songs --- openlp/plugins/songs/forms/editsongdialog.py | 3 +-- openlp/plugins/songs/forms/editsongform.py | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 41b307446..f9c967225 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -380,11 +380,10 @@ class Ui_EditSongDialog(object): self.verticalLayout.addWidget(self.ButtonBox) self.retranslateUi(EditSongDialog) - self.SongTabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), EditSongDialog.close) QtCore.QObject.connect(self.ButtonBox, - QtCore.SIGNAL(u'accepted()'), EditSongDialog.close) + QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept) QtCore.QMetaObject.connectSlotsByName(EditSongDialog) EditSongDialog.setTabOrder(self.SongTabWidget, self.TitleEditItem) EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index ef5fd846a..0c4a1d6b2 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -122,6 +122,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def newSong(self): log.debug(u'New Song') + self.SongTabWidget.setCurrentIndex(0) self.song = Song() self.TitleEditItem.setText(u'') self.AlternativeEdit.setText(u'') @@ -140,6 +141,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def loadSong(self, id): log.debug(u'Load Song') + self.SongTabWidget.setCurrentIndex(0) self.loadAuthors() self.loadTopics() self.loadBooks() @@ -341,8 +343,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.loadBooks() self.loadTopics() - def onAccept(self): - log.debug(u'OnAccept') + def accept(self): + log.debug(u'accept') if not self._validate_song(): return self.song.title = unicode(self.TitleEditItem.displayText())