forked from openlp/openlp
Tidy ups
This commit is contained in:
parent
f697e3ba09
commit
cf0a970184
11
openlp.pyw
11
openlp.pyw
@ -273,11 +273,12 @@ def main():
|
|||||||
# Define the settings environment
|
# Define the settings environment
|
||||||
QtCore.QSettings(u'OpenLP', u'OpenLP')
|
QtCore.QSettings(u'OpenLP', u'OpenLP')
|
||||||
# First time checks in settings
|
# First time checks in settings
|
||||||
# if QtCore.QSettings().value(
|
# Use explicit reference as not inside a QT environment yet
|
||||||
# u'general/first time', QtCore.QVariant(True)).toBool():
|
if QtCore.QSettings(u'OpenLP', u'OpenLP').value(
|
||||||
# if not FirstTimeLanguageForm().exec_():
|
u'general/first time', QtCore.QVariant(True)).toBool():
|
||||||
# # if cancel then stop processing
|
if not FirstTimeLanguageForm().exec_():
|
||||||
# sys.exit()
|
# if cancel then stop processing
|
||||||
|
sys.exit()
|
||||||
if sys.platform == u'darwin':
|
if sys.platform == u'darwin':
|
||||||
OpenLP.addLibraryPath(QtGui.QApplication.applicationDirPath()
|
OpenLP.addLibraryPath(QtGui.QApplication.applicationDirPath()
|
||||||
+ "/qt4_plugins")
|
+ "/qt4_plugins")
|
||||||
|
@ -34,7 +34,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from firsttimewizard import Ui_FirstTimeWizard
|
from firsttimewizard import Ui_FirstTimeWizard
|
||||||
|
|
||||||
from openlp.core.lib import translate, PluginStatus, check_directory_exists, Receiver
|
from openlp.core.lib import translate, PluginStatus, check_directory_exists, \
|
||||||
|
Receiver
|
||||||
from openlp.core.utils import get_web_page, AppLocation
|
from openlp.core.utils import get_web_page, AppLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -91,7 +92,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
self.__loadChild(treewidgetitem, u'songs', u'languages', u'songs')
|
self.__loadChild(treewidgetitem, u'songs', u'languages', u'songs')
|
||||||
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
|
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
|
||||||
treewidgetitem.setText(0, self.biblesText)
|
treewidgetitem.setText(0, self.biblesText)
|
||||||
self.__loadChild(treewidgetitem, u'bibles', u'translations', u'bible')
|
self.__loadChild(treewidgetitem, u'bibles', u'translations',
|
||||||
|
u'bible')
|
||||||
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
|
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
|
||||||
treewidgetitem.setText(0, self.themesText)
|
treewidgetitem.setText(0, self.themesText)
|
||||||
self.__loadChild(treewidgetitem, u'themes', u'files', 'theme')
|
self.__loadChild(treewidgetitem, u'themes', u'files', 'theme')
|
||||||
@ -127,11 +129,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
if parent and listIterator.value().checkState(0) \
|
if parent and listIterator.value().checkState(0) \
|
||||||
== QtCore.Qt.Checked:
|
== QtCore.Qt.Checked:
|
||||||
if unicode(parent.text(0)) == self.themesText:
|
if unicode(parent.text(0)) == self.themesText:
|
||||||
self.themeSelectionComboBox.addItem(listIterator.value().text(0))
|
self.themeSelectionComboBox.addItem(
|
||||||
|
listIterator.value().text(0))
|
||||||
listIterator += 1
|
listIterator += 1
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.__updateMessage(self.startUpdates)
|
self.__updateMessage(self.startUpdates)
|
||||||
|
# Set up the Plugin status's
|
||||||
self.__pluginStatus(self.songsCheckBox, u'songs/status')
|
self.__pluginStatus(self.songsCheckBox, u'songs/status')
|
||||||
self.__pluginStatus(self.bibleCheckBox, u'bibles/status')
|
self.__pluginStatus(self.bibleCheckBox, u'bibles/status')
|
||||||
self.__pluginStatus(self.presentationCheckBox, u'presentations/status')
|
self.__pluginStatus(self.presentationCheckBox, u'presentations/status')
|
||||||
@ -141,34 +145,58 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
self.__pluginStatus(self.customCheckBox, u'custom/status')
|
self.__pluginStatus(self.customCheckBox, u'custom/status')
|
||||||
self.__pluginStatus(self.songUsageCheckBox, u'songusage/status')
|
self.__pluginStatus(self.songUsageCheckBox, u'songusage/status')
|
||||||
self.__pluginStatus(self.alertCheckBox, u'alerts/status')
|
self.__pluginStatus(self.alertCheckBox, u'alerts/status')
|
||||||
|
# Build directories for downloads
|
||||||
listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget)
|
|
||||||
songsDestination = AppLocation.get_section_data_path(u'songs')
|
songsDestination = AppLocation.get_section_data_path(u'songs')
|
||||||
check_directory_exists(songsDestination)
|
check_directory_exists(songsDestination)
|
||||||
bibleDestination = AppLocation.get_section_data_path(u'bibles')
|
bibleDestination = AppLocation.get_section_data_path(u'bibles')
|
||||||
check_directory_exists(bibleDestination)
|
check_directory_exists(bibleDestination)
|
||||||
themeDestination = AppLocation.get_section_data_path(u'themes')
|
themeDestination = AppLocation.get_section_data_path(u'themes')
|
||||||
check_directory_exists(themeDestination)
|
check_directory_exists(themeDestination)
|
||||||
|
# Install Selected Items looping through them
|
||||||
|
listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget)
|
||||||
while listIterator.value():
|
while listIterator.value():
|
||||||
type = listIterator.value().parent()
|
type = listIterator.value().parent()
|
||||||
if listIterator.value().parent():
|
if listIterator.value().parent():
|
||||||
if listIterator.value().checkState(0) == QtCore.Qt.Checked:
|
if listIterator.value().checkState(0) == QtCore.Qt.Checked:
|
||||||
# Install
|
# Install items as theu have been selected
|
||||||
|
item = unicode(listIterator.value().text(0))
|
||||||
|
# Download Song database if selected
|
||||||
|
if unicode(type.text(0)) == self.songsText:
|
||||||
|
songs = unicode(listIterator.value().data(0,
|
||||||
|
QtCore.Qt.UserRole).toString())
|
||||||
|
message = u'%s %s' % (self.downloadSongs, item)
|
||||||
|
self.__updateMessage(message)
|
||||||
|
# Song database is a fixed file name
|
||||||
|
urllib.urlretrieve(u'%s%s' % (self.web, songs),
|
||||||
|
os.path.join(songsDestination, u'songs.sqlite'))
|
||||||
|
# Download and selected Bibles
|
||||||
if unicode(type.text(0)) == self.biblesText:
|
if unicode(type.text(0)) == self.biblesText:
|
||||||
bible = unicode(listIterator.value().data(0,
|
bible = unicode(listIterator.value().data(0,
|
||||||
QtCore.Qt.UserRole).toString())
|
QtCore.Qt.UserRole).toString())
|
||||||
message = u'%s %s' % (self.downloadBible, bible)
|
message = u'%s %s' % (self.downloadBible, item)
|
||||||
self.__updateMessage(message)
|
self.__updateMessage(message)
|
||||||
urllib.urlretrieve(u'%s%s' % (self.web, bible),
|
urllib.urlretrieve(u'%s%s' % (self.web, bible),
|
||||||
os.path.join(bibleDestination, bible))
|
os.path.join(bibleDestination, bible))
|
||||||
|
# Download any themes
|
||||||
if unicode(type.text(0)) == self.themesText:
|
if unicode(type.text(0)) == self.themesText:
|
||||||
theme = unicode(listIterator.value().data(0,
|
theme = unicode(listIterator.value().data(0,
|
||||||
QtCore.Qt.UserRole).toString())
|
QtCore.Qt.UserRole).toString())
|
||||||
message = u'%s %s' % (self.downloadTheme, bible)
|
message = u'%s %s' % (self.downloadTheme, item)
|
||||||
self.__updateMessage(message)
|
self.__updateMessage(message)
|
||||||
urllib.urlretrieve(u'%s%s' % (self.web, theme),
|
urllib.urlretrieve(u'%s%s' % (self.web, theme),
|
||||||
os.path.join(themeDestination, theme))
|
os.path.join(themeDestination, theme))
|
||||||
listIterator += 1
|
listIterator += 1
|
||||||
|
# Set Default Display
|
||||||
|
if self.displaySelectionComboBox.currentIndex() != -1:
|
||||||
|
QtCore.QSettings().setValue(u'General/monitor',
|
||||||
|
QtCore.QVariant(self.displaySelectionComboBox.
|
||||||
|
currentIndex()))
|
||||||
|
# Set Global Theme
|
||||||
|
if self.themeSelectionComboBox.currentIndex() != -1:
|
||||||
|
QtCore.QSettings().setValue(u'themes/global theme',
|
||||||
|
QtCore.QVariant(self.themeSelectionComboBox.currentText()))
|
||||||
|
QtCore.QSettings().setValue(u'general/first time',
|
||||||
|
QtCore.QVariant(False))
|
||||||
return QtGui.QWizard.accept(self)
|
return QtGui.QWizard.accept(self)
|
||||||
|
|
||||||
def __pluginStatus(self, field, tag):
|
def __pluginStatus(self, field, tag):
|
||||||
@ -177,5 +205,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
QtCore.QSettings().setValue(tag, QtCore.QVariant(status))
|
QtCore.QSettings().setValue(tag, QtCore.QVariant(status))
|
||||||
|
|
||||||
def __updateMessage(self, text):
|
def __updateMessage(self, text):
|
||||||
|
"""
|
||||||
|
Keep screen up to date
|
||||||
|
"""
|
||||||
self.updateLabel.setText(text)
|
self.updateLabel.setText(text)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
@ -627,8 +627,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.settingsForm.postSetUp()
|
self.settingsForm.postSetUp()
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
# Import themes if first time
|
# Import themes if first time
|
||||||
# if firstTime:
|
if firstTime:
|
||||||
# self.themeManagerContents.firstTime()
|
self.themeManagerContents.firstTime()
|
||||||
|
|
||||||
def setAutoLanguage(self, value):
|
def setAutoLanguage(self, value):
|
||||||
self.LanguageGroup.setDisabled(value)
|
self.LanguageGroup.setDisabled(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user