def __init__(self, card, component_manager, allow_cancel=True, started_from_card_browser=False, parent=None): # Note: even though this is in essence an EditFactDlg, we don't use # 'fact' as argument, as 'fact' does not know anything about card # types. AddEditCards.__init__(self, component_manager) if parent is None: parent = self.main_widget() QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(self.windowFlags() \ | QtCore.Qt.WindowMinMaxButtonsHint) self.setWindowFlags(self.windowFlags() \ & ~ QtCore.Qt.WindowContextHelpButtonHint) self.started_from_card_browser = started_from_card_browser self.before_apply_hook = None self.after_apply_hook = None self.allow_cancel = allow_cancel if not allow_cancel: self.exit_button.setVisible(False) self.card = card self.initialise_card_types_combobox(_(self.card.card_type.name)) self.update_tags_combobox(self.card.tag_string()) state = self.config()["edit_card_dlg_state"] if state: self.restoreGeometry(state) self.review_widget().stop_media() # Make sure we can capture PageUp/PageDown keys before any of the # children (e.g. comboboxes) do so. if self.started_from_card_browser: for child in self.children(): child.installEventFilter(self)
def update_card_widget(self, keep_data_from_previous_widget=True): AddEditCards.update_card_widget(self, keep_data_from_previous_widget) # Install event filters if we need to capture PageUp/PageDown. if self.started_from_card_browser: for child in self.card_type_widget.children(): # Make sure we don't install the filter twice. child.removeEventFilter(self) child.installEventFilter(self)
def __init__(self, component_manager, return_values, parent=None): AddEditCards.__init__(self, component_manager) if parent is None: parent = self.main_widget() QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.setWindowFlags(self.windowFlags() \ | QtCore.Qt.WindowMinMaxButtonsHint) self.setWindowFlags(self.windowFlags() \ & ~ QtCore.Qt.WindowContextHelpButtonHint) self.return_values = return_values self.update_tags_combobox("")
def __init__(self, fact, component_manager, allow_cancel=True): AddEditCards.__init__(self, component_manager) QtGui.QDialog.__init__(self, self.main_widget()) self.setupUi(self) if not allow_cancel: self.exit_button.setVisible(False) self.fact = fact self.initialise_card_types_combobox(self.fact.card_type.name) tag_string = self.database().cards_from_fact(fact)[0].tag_string() self.update_tags_combobox(tag_string) width, height = self.config()["edit_widget_size"] if width: self.resize(width, height)