def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, parent) self.setupUi(self) sync_port = self.config()["sync_server_port"] web_port = self.config()["web_server_port"] self.sync_server_initially_running = self.is_server_running(sync_port) self.web_server_initially_running = self.is_server_running(web_port) self.run_sync_server.setChecked(self.config()["run_sync_server"]) self.sync_port.setValue(sync_port) self.username.setText(self.config()["remote_access_username"]) self.password.setText(self.config()["remote_access_password"]) self.check_for_edited_local_media_files.setChecked(\ self.config()["check_for_edited_local_media_files"]) self.run_web_server.setChecked(self.config()["run_web_server"]) self.web_port.setValue(web_port) if self.is_server_running(sync_port): self.sync_server_status.setText(_("Sync server running on ") + \ localhost_IP() + " .") else: self.sync_server_status.setText(_("Sync server NOT running.")) if self.is_server_running(web_port): self.web_server_status.setText(_("Web server running on ") + \ "http://" + localhost_IP() + ":" + str(web_port) + " .") else: self.web_server_status.setText(_("Web server NOT running."))
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, self.main_widget()) self.vlayout = QtGui.QVBoxLayout(self) self.hlayout = QtGui.QHBoxLayout() self.label = QtGui.QLabel("My value") self.hlayout.addWidget(self.label) self.my_value = QtGui.QSpinBox(self) self.my_value.setValue(self.config()["my_value"]) self.hlayout.addWidget(self.my_value) self.vlayout.addLayout(self.hlayout)
def __init__(self, component_manager): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, self.main_widget()) self.vlayout = QtGui.QVBoxLayout(self) self.hlayout = QtGui.QHBoxLayout() self.label = QtGui.QLabel("My value") self.hlayout.addWidget(self.label) self.my_value = QtGui.QSpinBox(self) self.my_value.setProperty("value", QtCore.QVariant(10)) self.hlayout.addWidget(self.my_value) self.vlayout.addLayout(self.hlayout)
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, parent) self.setupUi(self) if self.config()["cramming_order"] == RANDOM: self.order.setCurrentIndex(0) elif self.config()["cramming_order"] == EARLIEST_FIRST: self.order.setCurrentIndex(1) elif self.config()["cramming_order"] == LATEST_FIRST: self.order.setCurrentIndex(2) elif self.config()["cramming_order"] == MOST_LAPSES_FIRST: self.order.setCurrentIndex(3) if self.config()["cramming_store_state"] == True: self.store_state.setCheckState(QtCore.Qt.Checked) else: self.store_state.setCheckState(QtCore.Qt.Unchecked)
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.dynamic_widgets = [] self.affected_card_types = [] self.fact_key_names = [] self.non_latin_font_size_increase.setValue\ (self.config()['non_latin_font_size_increase']) # We calculate card_type_by_name here because these names can change # if the user chooses another translation. self.card_types_widget.addItem(_("<all card types>")) self.card_type_by_name = {} for card_type in self.database().sorted_card_types(): self.card_type_by_name[_(card_type.name)] = card_type self.card_types_widget.addItem(_(card_type.name)) # Store backups in order to be able to revert our changes. self.old_font = deepcopy(self.config()["font"]) self.old_background_colour = \ deepcopy(self.config()["background_colour"]) self.old_font_colour = deepcopy(self.config()["font_colour"]) self.old_alignment = deepcopy(self.config()["alignment"])
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, parent) self.setupUi(self) if self.config()["randomise_new_cards"] == True: self.new_cards.setCurrentIndex(1) else: self.new_cards.setCurrentIndex(0) if self.config()["randomise_scheduled_cards"] == True: self.scheduled_cards.setCurrentIndex(1) else: self.scheduled_cards.setCurrentIndex(0) self.non_memorised_cards.setValue(self.config()\ ["non_memorised_cards_in_hand"]) self.save_after_n_reps.setValue(self.config()\ ["save_after_n_reps"]) if self.config()["media_autoplay"] == True: self.media_autoplay.setCheckState(QtCore.Qt.Checked) else: self.media_autoplay.setCheckState(QtCore.Qt.Unchecked) if self.config()["media_controls"] == True: self.media_controls.setCheckState(QtCore.Qt.Checked) else: self.media_controls.setCheckState(QtCore.Qt.Unchecked) if self.config()["upload_science_logs"] == True: self.upload_science_logs.setCheckState(QtCore.Qt.Checked) else: self.upload_science_logs.setCheckState(QtCore.Qt.Unchecked) language_names = ["English"] for language in self.translator().supported_languages(): language_names.append(language_name_for_iso6931_code[language]) language_names.sort() for language_name in language_names: self.languages.addItem(language_name) self.languages.setCurrentIndex(self.languages.findText(\ language_name_for_iso6931_code[self.config()["ui_language"]])) self.media_autoplay.stateChanged.connect(self.changed_media_autoplay) if sys.platform == "win32": self.audio_box.hide()
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, parent) self.setupUi(self) if self.config()["randomise_new_cards"] == True: self.new_cards.setCurrentIndex(1) else: self.new_cards.setCurrentIndex(0) if self.config()["randomise_scheduled_cards"] == True: self.scheduled_cards.setCurrentIndex(1) else: self.scheduled_cards.setCurrentIndex(0) self.non_memorised_cards.setValue(self.config()["non_memorised_cards_in_hand"]) self.save_after_n_reps.setValue(self.config()["save_after_n_reps"]) if self.config()["media_autoplay"] == True: self.media_autoplay.setCheckState(QtCore.Qt.Checked) else: self.media_autoplay.setCheckState(QtCore.Qt.Unchecked) if self.config()["media_controls"] == True: self.media_controls.setCheckState(QtCore.Qt.Checked) else: self.media_controls.setCheckState(QtCore.Qt.Unchecked) if self.config()["upload_science_logs"] == True: self.upload_science_logs.setCheckState(QtCore.Qt.Checked) else: self.upload_science_logs.setCheckState(QtCore.Qt.Unchecked) language_names = ["English"] for language in self.translator().supported_languages(): language_names.append(language_name_for_iso6931_code[language]) language_names.sort() for language_name in language_names: self.languages.addItem(language_name) self.languages.setCurrentIndex( self.languages.findText(language_name_for_iso6931_code[self.config()["ui_language"]]) ) self.media_autoplay.stateChanged.connect(self.changed_media_autoplay) if sys.platform == "win32": self.audio_box.hide()
def __init__(self, component_manager, parent): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, parent) self.setupUi(self)
def __init__(self, component_manager): ConfigurationWidget.__init__(self, component_manager) QtGui.QDialog.__init__(self, self.main_widget()) self.setupUi(self)