예제 #1
0
 def __init__(self, component_manager):
     ActivateCardsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())
     self.setupUi(self)
     self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowMinMaxButtonsHint)
     self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
     # Initialise widgets.
     self.was_showing_a_saved_set = False
     self.is_shutting_down = False
     criterion = self.database().current_criterion()
     self.criterion_classes = self.component_manager.all("criterion")
     current_criterion = self.database().current_criterion()
     self.widget_for_criterion_type = {}
     for criterion_class in self.criterion_classes:
         widget = self.component_manager.current("criterion_widget", used_for=criterion_class)(
             self.component_manager, self
         )
         self.tab_widget.addTab(widget, criterion_class.criterion_type)
         self.widget_for_criterion_type[criterion_class.criterion_type] = widget
     self.tab_widget.setCurrentWidget(self.widget_for_criterion_type[current_criterion.criterion_type])
     self.tab_widget.tabBar().setVisible(self.tab_widget.count() > 1)
     self.tab_widget.currentWidget().display_criterion(current_criterion)
     # Restore state.
     state = self.config()["activate_cards_dlg_state"]
     if state:
         self.restoreGeometry(state)
     splitter_state = self.config()["activate_cards_dlg_splitter_state"]
     if not splitter_state:
         self.splitter.setSizes([100, 350])
     else:
         self.splitter.restoreState(splitter_state)
     # Should go last, otherwise the selection of the saved sets pane will
     # always be cleared.
     self.update_saved_sets_pane()
예제 #2
0
 def activate(self):
     ActivateCardsDialog.activate(self)
     self.criteria_by_name = {}
     active_set_name = ""
     active_criterion = self.database().current_criterion()
     for criterion in self.database().criteria():
         if criterion._id != 1:
             self.criteria_by_name[criterion.name] = criterion
             if criterion == active_criterion:
                 active_set_name = criterion.name
     self.component_manager.android.showActivateCardsDialog(\
         "____".join(sorted(self.criteria_by_name.keys())), active_set_name, self)
예제 #3
0
 def activate(self):
     ActivateCardsDialog.activate(self)
     self.criteria_by_name = {}
     active_set_name = ""
     active_criterion = self.database().current_criterion()
     for criterion in self.database().criteria():
         if criterion._id != 1:
             self.criteria_by_name[criterion.name] = criterion
             if criterion == active_criterion:
                 active_set_name = criterion.name
     _dialogs.activate_cards_dlg_activate(\
         "____".join(sorted(self.criteria_by_name.keys())), active_set_name)
예제 #4
0
 def __init__(self, component_manager):
     ActivateCardsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())
     self.setupUi(self)
     # Restore sizes.
     config = self.config()
     width, height = config["activate_cards_dlg_size"]
     if width:
         self.resize(width, height)
     splitter_sizes = config["activate_cards_dlg_splitter"]
     if not splitter_sizes:
         self.splitter.setSizes([100, 350])
     else:
         self.splitter.setSizes(splitter_sizes)
     # Initialise widgets.
     self.saved_sets.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     self.connect(self.saved_sets,
                  QtCore.SIGNAL("customContextMenuRequested(QPoint)"),
                  self.saved_sets_custom_menu)
     self.update_saved_sets_pane()
     criterion = self.database().current_activity_criterion()
     self.criterion_classes = \
         self.component_manager.get_all("activity_criterion")
     if len(self.criterion_classes) == 1:
         criterion = self.database().current_activity_criterion()
         self.widget = self.component_manager.get_current\
                 ("activity_criterion_widget", used_for=criterion.__class__)\
                       (self.component_manager, self)
         self.criterion_layout.insertWidget(0, self.widget)
         self.widget.display_criterion(criterion)
     else:  
         self.tab_widget = QtGui.QTabWidget(self)
         current_criterion = self.database().current_activity_criterion()
         self.widget_for_criterion_type = {}
         for criterion_class in self.criterion_classes:
             widget = self.component_manager.get_current\
                 ("activity_criterion_widget", used_for=criterion_class)\
                       (self.component_manager, self)
             self.tab_widget.addTab(widget, criterion_class.criterion_type)
             self.widget_for_criterion_type\
                 [criterion_class.criterion_type] = widget
         self.tab_widget.setCurrentWidget(self.widget_for_criterion_type\
                                          [current_criterion.criterion_type])
         self.widget = self.tab_widget.currentWidget()
         self.widget.display_criterion(current_criterion)
         self.criterion_layout.insertWidget(0, self.tab_widget)
         self.connect(self.tab_widget, QtCore.SIGNAL("currentChanged(int)"),
                      self.change_widget)
예제 #5
0
 def __init__(self, component_manager):
     ActivateCardsDialog.__init__(self, component_manager)
     QtGui.QDialog.__init__(self, self.main_widget())
     self.setupUi(self)
     self.setWindowFlags(self.windowFlags() \
         | QtCore.Qt.WindowMinMaxButtonsHint)
     self.setWindowFlags(self.windowFlags() \
         & ~ QtCore.Qt.WindowContextHelpButtonHint)
     # Initialise widgets.
     self.was_showing_a_saved_set = False
     self.is_shutting_down = False
     criterion = self.database().current_criterion()
     self.criterion_classes = \
         self.component_manager.all("criterion")
     current_criterion = self.database().current_criterion()
     self.widget_for_criterion_type = {}
     for criterion_class in self.criterion_classes:
         widget = self.component_manager.current\
             ("criterion_widget", used_for=criterion_class)\
             (self.component_manager, self)
         self.tab_widget.addTab(widget, criterion_class.criterion_type)
         self.widget_for_criterion_type[criterion_class.criterion_type] \
             = widget
     self.tab_widget.setCurrentWidget(self.widget_for_criterion_type\
                                      [current_criterion.criterion_type])
     self.tab_widget.tabBar().setVisible(self.tab_widget.count() > 1)
     self.tab_widget.currentWidget().display_criterion(current_criterion)
     # Restore state.
     state = self.config()["activate_cards_dlg_state"]
     if state:
         self.restoreGeometry(state)
     splitter_state = self.config()["activate_cards_dlg_splitter_state"]
     if not splitter_state:
         self.splitter.setSizes([100, 350])
     else:
         self.splitter.restoreState(splitter_state)
     # Should go last, otherwise the selection of the saved sets pane will
     # always be cleared.
     self.update_saved_sets_pane()
예제 #6
0
 def __init__(self, component_manager):
     ActivateCardsDialog.__init__(self, component_manager)
예제 #7
0
 def __init__(self, component_manager):
     ActivateCardsDialog.__init__(self, component_manager)    
 def activate(self):
     ActivateCardsDialog.activate(self)
     self.exec_()