Exemplo n.º 1
0
 def __init__(self, component_manager):
     StatisticsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())
     self.setWindowTitle(_("Statistics"))
     self.vbox_layout = QtGui.QVBoxLayout(self)
     self.tab_widget = QtGui.QTabWidget(self.main_widget())
     page_index = 0
     for page in self.statistics_pages():
         page = page(self.component_manager)
         self.tab_widget.addTab(StatisticsPageWdgt(component_manager, self,
             page, page_index), page.name)
         page_index += 1
     self.vbox_layout.addWidget(self.tab_widget)       
     self.button_layout = QtGui.QHBoxLayout()
     self.button_layout.addItem(QtGui.QSpacerItem(20, 20,
         QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum))
     self.ok_button = QtGui.QPushButton(_("&OK"), self)
     self.button_layout.addWidget(self.ok_button)
     self.vbox_layout.addLayout(self.button_layout)
     self.connect(self.ok_button, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.tab_widget, QtCore.SIGNAL("currentChanged(int)"),
                  self.display_page)
     page_index = self.config()["last_statistics_page"]
     if page_index >= self.tab_widget.count():
         page_index = 0
     self.tab_widget.setCurrentIndex(page_index)
     self.display_page(page_index)
Exemplo n.º 2
0
 def activate(self):
     StatisticsDialog.activate(self)
     self.setupUi(self)
     self.setWindowFlags(self.windowFlags() \
         | QtCore.Qt.WindowMinMaxButtonsHint)
     self.setWindowFlags(self.windowFlags() \
         & ~ QtCore.Qt.WindowContextHelpButtonHint)
     previous_page_index = self.config()["previous_statistics_page"]
     page_index = 0
     for page in self.component_manager.all("statistics_page"):
         page = page(component_manager=self.component_manager)
         self.tab_widget.addTab(
             StatisticsPageWdgt(page,
                                page_index,
                                parent=self,
                                component_manager=self.component_manager),
             _(page.name))
         page_index += 1
     self.tab_widget.tabBar().setVisible(self.tab_widget.count() > 1)
     if previous_page_index >= self.tab_widget.count():
         previous_page_index = 0
     self.tab_widget.setCurrentIndex(previous_page_index)
     self.display_page(previous_page_index)
     state = self.config()["statistics_dlg_state"]
     if state:
         self.restoreGeometry(state)
     # Only now do we connect the signal in order to have lazy
     # instantiation.
     self.tab_widget.currentChanged[int].connect(self.display_page)
     self.exec_()
Exemplo n.º 3
0
    def __init__(self, component_manager, previous_mode=None):
        StatisticsDialog.__init__(self, component_manager)
        self.renderer = self.component_manager.get_current("renderer")
        self.previous_mode = previous_mode
        self.html = (
            '<html><head><meta http-equiv="Content-Type" content='
            '"text/html;charset=UTF-8"><style type="text/css">*{font-size:28px;'
            "font-family:Nokia Sans} table {height:100%;margin-left:auto;margin-"
            "right:auto;text-align:center} body{ background-color:white;margin:0;"
            "padding:0;}</style></head><body><table>"
        )
        # create widgets
        self.page, self.mode_statistics_switcher, menu_button, current_card_button, common_card_button, tags_card_button, self.current_card_html_widget, self.total_card_html_widget, self.tags_html_widget = create_statistics_ui(
            self.main_widget().switcher
        )
        # connect signals
        menu_button.connect("clicked", self.back_to_previous_mode_cb)
        current_card_button.connect("released", self.current_card_statistics_cb)
        common_card_button.connect("released", self.common_statistics_cb)
        tags_card_button.connect("released", self.tags_statistics_cb)

        # change current statistics page
        try:
            statistics_page = self.config()["last_variant_for_statistics_page"]
        except KeyError:
            statistics_page = 2

        if statistics_page == 0:
            current_card_button.set_active(True)
            self.current_card_statistics_cb(None)
        elif statistics_page == 1:
            common_card_button.set_active(True)
            self.common_statistics_cb(None)
        else:
            tags_card_button.set_active(True)
            self.tags_statistics_cb(None)
Exemplo n.º 4
0
 def __init__(self, component_manager):
     StatisticsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())
Exemplo n.º 5
0
 def __init__(self, component_manager):
     StatisticsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())