add a button to configure backends
This commit is contained in:
parent
9581fa0b19
commit
b620ef7460
2 changed files with 41 additions and 10 deletions
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
from PyQt4.QtCore import SIGNAL
|
||||
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
from weboob.tools.application.qt import QtMainWindow, QtDo
|
||||
from weboob.tools.application.qt.backendcfg import BackendCfg
|
||||
|
||||
from weboob.applications.qvideoob.ui.main_window_ui import Ui_MainWindow
|
||||
|
||||
|
|
@ -35,11 +37,6 @@ class MainWindow(QtMainWindow):
|
|||
self.weboob = weboob
|
||||
self.minivideos = []
|
||||
|
||||
self.ui.backendEdit.addItem('All backends', '')
|
||||
for i, backend in enumerate(self.weboob.iter_backends()):
|
||||
self.ui.backendEdit.addItem(backend.name, backend.name)
|
||||
if backend.name == self.config.get('settings', 'backend'):
|
||||
self.ui.backendEdit.setCurrentIndex(i+1)
|
||||
self.ui.sortbyEdit.setCurrentIndex(int(self.config.get('settings', 'sortby')))
|
||||
self.ui.nsfwCheckBox.setChecked(int(self.config.get('settings', 'nsfw')))
|
||||
self.ui.sfwCheckBox.setChecked(int(self.config.get('settings', 'sfw')))
|
||||
|
|
@ -49,6 +46,23 @@ class MainWindow(QtMainWindow):
|
|||
self.connect(self.ui.nsfwCheckBox, SIGNAL("stateChanged(int)"), self.nsfwChanged)
|
||||
self.connect(self.ui.sfwCheckBox, SIGNAL("stateChanged(int)"), self.sfwChanged)
|
||||
|
||||
self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig)
|
||||
|
||||
self.loadBackendsList()
|
||||
|
||||
def backendsConfig(self):
|
||||
bckndcfg = BackendCfg(self.weboob, (ICapVideo,), self)
|
||||
if bckndcfg.run():
|
||||
self.loadBackendsList()
|
||||
|
||||
def loadBackendsList(self):
|
||||
self.ui.backendEdit.clear()
|
||||
self.ui.backendEdit.addItem('All backends', '')
|
||||
for i, backend in enumerate(self.weboob.iter_backends()):
|
||||
self.ui.backendEdit.addItem(backend.name, backend.name)
|
||||
if backend.name == self.config.get('settings', 'backend'):
|
||||
self.ui.backendEdit.setCurrentIndex(i+1)
|
||||
|
||||
def nsfwChanged(self, state):
|
||||
self.config.set('settings', 'nsfw', int(self.ui.nsfwCheckBox.isChecked()))
|
||||
self.updateVideosDisplay()
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>785</width>
|
||||
<height>594</height>
|
||||
<width>582</width>
|
||||
<height>463</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -139,8 +139,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>763</width>
|
||||
<height>391</height>
|
||||
<width>560</width>
|
||||
<height>230</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
@ -181,12 +181,29 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>785</width>
|
||||
<width>582</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionBackends"/>
|
||||
</widget>
|
||||
<action name="actionBackends">
|
||||
<property name="text">
|
||||
<string>Backends</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue