Lists from the web now

This commit is contained in:
Tim Bentley 2011-02-27 15:33:08 +00:00
parent b4156c809b
commit 0e773c7a1b
2 changed files with 53 additions and 28 deletions

View File

@ -44,8 +44,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
def __init__(self, parent=None): def __init__(self, parent=None):
# check to see if we have web access # check to see if we have web access
self.webAccess = get_web_page(u'http://openlp.org1') self.webAccess = get_web_page(u'http://openlp.org/files/frw/themes.lst')
print self.webAccess print self.webAccess
if self.webAccess:
self.themes = self.webAccess.read()
songs = get_web_page(u'http://openlp.org/files/frw/songs.lst')
self.songs = songs.read()
bibles = get_web_page(u'http://openlp.org/files/frw/bibles.lst')
self.bibles = bibles.read()
QtGui.QWizard.__init__(self, parent) QtGui.QWizard.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.autoLanguageCheckBox, QtCore.QObject.connect(self.autoLanguageCheckBox,
@ -78,6 +84,26 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.qmList = LanguageManager.get_qm_list() self.qmList = LanguageManager.get_qm_list()
for key in sorted(self.qmList.keys()): for key in sorted(self.qmList.keys()):
self.LanguageComboBox.addItem(key) self.LanguageComboBox.addItem(key)
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, u'Songs')
self.__loadChild(treewidgetitem, self.songs)
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, u'Bibles')
self.__loadChild(treewidgetitem, self.bibles)
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, u'Themes')
self.__loadChild(treewidgetitem, self.themes)
def __loadChild(self, tree, list):
list = list.split(u'\n')
for item in list:
if item:
child = QtGui.QTreeWidgetItem(tree)
child.setText(0, item)
child.setCheckState(0, QtCore.Qt.Unchecked)
child.setFlags(QtCore.Qt.ItemIsUserCheckable |
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
#self.themeSelectionComboBox.addItem(theme)
def accept(self): def accept(self):
self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.songsCheckBox, u'songs/status')

View File

@ -250,10 +250,10 @@ p, li { white-space: pre-wrap; }
<widget class="QGroupBox" name="internetGroupBox"> <widget class="QGroupBox" name="internetGroupBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>20</x>
<y>50</y> <y>0</y>
<width>441</width> <width>501</width>
<height>191</height> <height>281</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -261,29 +261,28 @@ p, li { white-space: pre-wrap; }
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <widget class="QTreeWidget" name="selectionTreeWidget">
<item> <property name="horizontalScrollBarPolicy">
<widget class="QCheckBox" name="downLoadSongsCheckBox"> <enum>Qt::ScrollBarAlwaysOff</enum>
<property name="text"> </property>
<string>Sample Songs </string> <property name="showDropIndicator" stdset="0">
</property> <bool>false</bool>
</widget> </property>
</item> <property name="alternatingRowColors">
<item> <bool>true</bool>
<widget class="QCheckBox" name="downLoadBibleCheckBox"> </property>
<property name="text"> <property name="selectionMode">
<string>Bible XXX (Repeat per bible)</string> <enum>QAbstractItemView::NoSelection</enum>
</property> </property>
</widget> <attribute name="headerVisible">
</item> <bool>false</bool>
<item> </attribute>
<widget class="QCheckBox" name="downLoadThemeCheckBox"> <column>
<property name="text"> <property name="text">
<string>Theme XXX (Repeat per theme)</string> <string notr="true">1</string>
</property> </property>
</widget> </column>
</item> </widget>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>