def __init__(self): super().__init__() logging.debug("GUI: Setting up MainDialog") self.config_dlg = ConfigDialog(parent=self) # set window title and icon self.setWindowTitle("IRIDA Uploader") icon_path = os.path.join(os.path.dirname(__file__), 'images/icon.ico') self.setWindowIcon(QtGui.QIcon(icon_path)) # Initialize threads from the tools file self._status_thread = threads.StatusThread() self._parse_thread = threads.ParseThread() self._upload_thread = threads.UploadThread() # internal variables self._run_dir = "" self._config_file = "" self._uploading = False self._continue_partial = False # Setup gui objects self._init_objects() # Set Layout and Geometry self.setLayout(self._init_layout()) # resize window self.setGeometry(0, 0, 800, 600) # Center Window qt_rectangle = self.frameGeometry() center_point = QtWidgets.QDesktopWidget().availableGeometry().center() qt_rectangle.moveCenter(center_point) self.move(qt_rectangle.topLeft()) # Signals and Slots # buttons self._dir_button.clicked.connect(self._btn_open_dir) self._config_button.clicked.connect(self._btn_show_config) self._refresh_button.clicked.connect(self._btn_refresh) self._upload_button.clicked.connect(self._btn_upload) self._console_button.clicked.connect(self._btn_log) self._info_btn.clicked.connect(self._btn_continue) self._info_partial_btn.clicked.connect(self._btn_continue_partial) # connect threads finishing to finish functions self._status_thread.finished.connect(self._thread_finished_status) self._parse_thread.finished.connect(self._thread_finished_parse) self._upload_thread.finished.connect(self._thread_finished_upload) # init the config file config.setup() # block uploading at start self._upload_button.set_block()
def _get_settings_from_file(self): """ Loads the config settings from file and fills the widgets :return: """ config.setup() self._client_id.setText(config.read_config_option('client_id')) self._client_secret.setText(config.read_config_option('client_secret')) self._username.setText(config.read_config_option('username')) self._password.setText(config.read_config_option('password')) self._base_url.setText(config.read_config_option('base_url')) index = self._parser.findText(config.read_config_option('parser')) self._parser.setCurrentIndex(index)
def _get_settings_from_file(self): """ Loads the config settings from file and fills the widgets :return: """ config.setup() self._client_id.setText(config.read_config_option('client_id')) self._client_secret.setText(config.read_config_option('client_secret')) self._username.setText(config.read_config_option('username')) self._password.setText(config.read_config_option('password')) self._base_url.setText(config.read_config_option('base_url')) index = self._parser.findText(config.read_config_option('parser')) self._parser.setCurrentIndex(index) read_only_bool = config.read_config_option("readonly", bool, False) read_only_state = QtCore.Qt.Checked if read_only_bool else QtCore.Qt.Unchecked self._read_only_mode.setCheckState(read_only_state)