py::gui::main_window::main_window Class Reference

List of all members.

Public Member Functions

def __init__
def setup_cfg
def setup_ui
def setup_actions
def closeEvent
def fill
def page_changed
def update_album_count
def about_qomics
def create_album
def update_catalog
def reload_data
def configure_colors
def configure_mirrors
def configure_datasource
def create_savepoint
def manage_backups
def send_overlay
def send_overlay_silent

Public Attributes

 loaded
 album_counter
 tabwidget
 tabs

Static Public Attributes

string conf_section = "gui/main_window"

Private Attributes

 __current_page


Member Function Documentation

def py::gui::main_window::main_window::__init__ (   self  ) 

00046                              :
00047                 Ui_main_window.__init__( self )
00048                 QMainWindow.__init__( self )
00049                 self.setup_cfg()
00050                 self.setup_ui( self )
00051                 self.setup_actions()
00052                 import gui.main_window
00053                 gui.main_window.instance = self
00054                 self.loaded = threading.Event()
00055 
        def setup_cfg( self ) :

def py::gui::main_window::main_window::setup_cfg (   self  ) 

00056                               :
00057                 cfg = qocfg.get_user_config()
00058                 if not cfg.has_section(self.conf_section) :
00059                         cfg.add_section(self.conf_section)
00060 
        def setup_ui( self, parent ) :

def py::gui::main_window::main_window::setup_ui (   self,
  parent 
)

00061                                      :
00062                 Ui_main_window.setupUi(self, parent)
00063 
00064                 self.album_counter = QLabel()
00065                 self.statusBar().addPermanentWidget(self.album_counter)
00066 
00067                 self.tabwidget = QTabWidget(self.centralwidget)
00068                 self.vboxlayout.addWidget(self.tabwidget)
00069 
00070                 # setup tabs
00071                 self.tabs = {
00072                         "main_library" : gui.page.page(gui.views.flat_library("main_library",qodb.cte.main_library_id),True),
00073                         "shopping_list" : gui.page.page(gui.views.flat_library("shopping_list",qodb.cte.shopping_list_id),True),
00074                         "latestout" : gui.page.page(gui.views.flat_latestout("latestout"),True),
00075                         "nextout" : gui.page.page(gui.views.flat_nextout("nextout"),True),
00076                         "catalog" : gui.page.page(gui.views.flat_search("catalog"),True),
00077                 }
00078                 self.tabs["main_library_series"] = gui.page.page_series(gui.views.series("main_library_series",self.tabs["main_library"].model))
00079                 self.tabwidget.addTab(self.tabs["main_library"], _("My comics"))
00080                 self.tabwidget.addTab(self.tabs["main_library_series"], _("My series"))
00081                 self.tabwidget.addTab(self.tabs["shopping_list"], _("Shopping list"))
00082                 self.tabwidget.addTab(self.tabs["latestout"], _("Latest out"))
00083                 self.tabwidget.addTab(self.tabs["nextout"], _("Next out"))
00084                 self.tabwidget.addTab(self.tabs["catalog"], _("Catalog"))
00085 
00086                 # setup geometry
00087                 cfg = qocfg.get_user_config()
00088                 if cfg.has_option(self.conf_section,"geometry") :
00089                         self.restoreGeometry(cfg.get(self.conf_section,"geometry"))
00090 
00091                 # checkable options
00092                 self.action_auto_save.setChecked(qocfg.get_autosave_comics())
00093                 self.action_auto_fetch_covers.setChecked(qocfg.get_autofetch_covers())
00094                 self.action_auto_send_changes.setChecked(qocfg.get_autosend_overlay())
00095                 self.action_auto_savepoint.setChecked(qocfg.get_autosavepoint())
00096 
        def setup_actions( self ) :

def py::gui::main_window::main_window::setup_actions (   self  ) 

00097                                   :
00098                 for obj, slot in [ 
00099                                 (self.action_create_album, self.create_album),
00100                                 (self.action_update_catalog, self.update_catalog),
00101                                 (self.action_reload_data, self.reload_data),
00102                                 (self.action_configure_colors, self.configure_colors),
00103                                 (self.action_configure_mirrors, self.configure_mirrors),
00104                                 (self.action_configure_datasource, self.configure_datasource),
00105                                 (self.action_about_qomics, self.about_qomics),
00106                                 (self.action_manage_backups, self.manage_backups),
00107                                 (self.action_create_savepoint, self.create_savepoint),
00108                                 (self.action_send_changes, self.send_overlay),
00109                                 ] :
00110                         QObject.connect(obj, SIGNAL("activated()"), slot)
00111                 for obj, slot in [
00112                                 (self.action_auto_fetch_covers, qocfg.set_autofetch_covers),
00113                                 (self.action_auto_send_changes, qocfg.set_autosend_overlay),
00114                                 (self.action_auto_savepoint, qocfg.set_autosavepoint),
00115                                 ] :
00116                         QObject.connect(obj, SIGNAL("toggled(bool)"), slot)
00117 
00118                 QObject.connect(self.tabwidget, SIGNAL("currentChanged(int)"), self.page_changed)
00119                 QObject.connect(self, SIGNAL("fill"), self.fill)
00120                 self.__current_page = None
00121                 self.page_changed()
00122 
        def closeEvent( self, event ) :

def py::gui::main_window::main_window::closeEvent (   self,
  event 
)

00123                                       :
00124                 if qocfg.get_autosavepoint() :
00125                         gui.dialog.create_savepoint(self).exec_()
00126                 if qocfg.get_autosend_overlay() :
00127                         self.send_overlay()
00128                 for w in self.tabs.itervalues() :
00129                         w.save_geometry()
00130                         w.save()
00131                 qocfg.get_user_config().set(self.conf_section,"geometry",str(self.saveGeometry()))
00132                 QMainWindow.closeEvent( self, event )
00133         
        def fill( self ) :

def py::gui::main_window::main_window::fill (   self  ) 

reload all tabs
00134                          :
00135                 """
00136                 reload all tabs
00137                 """
00138                 # load libraries first
00139                 self.loaded.clear()
00140                 for view in ["main_library","shopping_list","main_library_series","latestout","nextout"] :
00141                         self.tabs[view].model.reload()
00142                 self.loaded.set()
00143 
        def page_changed( self ) :

def py::gui::main_window::main_window::page_changed (   self  ) 

00144                                  :
00145                 if self.__current_page :
00146                         QObject.disconnect(self.__current_page, SIGNAL("album_count_changed"), self.update_album_count)
00147                 self.__current_page = self.tabwidget.currentWidget()
00148                 QObject.connect(self.tabwidget.currentWidget(), SIGNAL("album_count_changed"), self.update_album_count)
00149                 self.update_album_count()
00150 
        def update_album_count( self ) :

def py::gui::main_window::main_window::update_album_count (   self  ) 

00151                                        :
00152                 self.album_counter.setText("    %d albums    "%self.tabwidget.currentWidget().count_albums())
00153         
00154         #
        # ACTIONS

def py::gui::main_window::main_window::about_qomics (   self  ) 

00158                                  :
00159                 gui.dialog.about_qomics(self).exec_()
00160 
00161         @gui.dialog.show_failure
        def create_album( self ) :

def py::gui::main_window::main_window::create_album (   self  ) 

00162                                  :
00163                 w = gui.editor.album(self, None)
00164                 if w.exec_() :
00165                         pass
00166 
00167         @gui.dialog.show_failure
        def update_catalog( self ) :

def py::gui::main_window::main_window::update_catalog (   self  ) 

00168                                    :
00169                 if gui.dialog.progress_notifier(self, _("Catalog update"), qo.catalog.update).exec_() :
00170                         self.reload_data()
00171 
00172         @gui.dialog.show_failure
        def reload_data( self ) :

def py::gui::main_window::main_window::reload_data (   self  ) 

00173                                 :
00174                 def worker() :
00175                         self.loaded.clear()
00176                         QObject.emit(self, SIGNAL("fill"))
00177                         self.loaded.wait()
00178                 gui.dialog.progress_busy(self, _("Reloading data..."), worker).exec_()
00179         
00180         @gui.dialog.show_failure
        def configure_colors( self ) :

def py::gui::main_window::main_window::configure_colors (   self  ) 

00181                                      :
00182                 gui.configure.colors(self).exec_()
00183 
00184         @gui.dialog.show_failure
        def configure_mirrors( self ) :

def py::gui::main_window::main_window::configure_mirrors (   self  ) 

00185                                       :
00186                 gui.configure.mirrors(self).exec_()
00187         
00188         @gui.dialog.show_failure
        def configure_datasource( self ) :

def py::gui::main_window::main_window::configure_datasource (   self  ) 

00189                                          :
00190                 gui.configure.datasource(self).exec_()
00191         
00192         @gui.dialog.show_failure
        def create_savepoint( self ) :

def py::gui::main_window::main_window::create_savepoint (   self  ) 

00193                                      :
00194                 gui.dialog.create_savepoint(self).exec_()
00195 
00196         @gui.dialog.show_failure
        def manage_backups( self ) :

def py::gui::main_window::main_window::manage_backups (   self  ) 

00197                                    :
00198                 gui.dialog.manage_backups(self).exec_()
00199         
00200         @gui.dialog.show_failure
        def send_overlay( self ) :

def py::gui::main_window::main_window::send_overlay (   self  ) 

00201                                  :
00202                 gui.dialog.progress_busy(self, _("Send your overlay..."), qo.share.send_overlay).exec_()
00203 
        def send_overlay_silent( self ) :

def py::gui::main_window::main_window::send_overlay_silent (   self  ) 

00204                                         :
00205                 qo.share.send_overlay()
00206 
00207 


Member Data Documentation

string py::gui::main_window::main_window::conf_section = "gui/main_window" [static]

py::gui::main_window::main_window::loaded

py::gui::main_window::main_window::album_counter

py::gui::main_window::main_window::tabwidget

py::gui::main_window::main_window::tabs

py::gui::main_window::main_window::__current_page [private]


The documentation for this class was generated from the following file:
Generated on Tue Oct 9 20:40:27 2007 for Qomics by  doxygen 1.5.3