def __init__(self): """ Constructor """ QMainWindow.__init__(self) # Assign the UI file to this window and maximize ui = Ui_MainWindow() ui.setupUi(self) self.showMaximized() # Set the window icon self.setWindowIcon(QIcon(c.FILE_ICON))
def open_main_window(self): model_path = self.modelCheckpointText.text() wordmap_path = self.wordMapPathText.text() try: beam_width = int(self.beamWidthSizeText.text()) except: self.alert('Beam width must be an integer') return self.window = QtWidgets.QMainWindow() self.ui = Ui_MainWindow() self.ui.setupUi(self.window, model_path, wordmap_path, beam_width) self.window.show()
def __init__(self): self.main_win = QMainWindow() self.ui = Ui_MainWindow() self.ui.setupUi(self.main_win)
def __init__(self, args=sys.argv): QtGui.QMainWindow.__init__(self) self.ui = Ui_MainWindow() self.ui.setupUi(self) self._win_title_default = str(self.windowTitle()) self._log = logging.getLogger(ConfigStatic.logger_name) self._log.info('passed') self._log.info('profiling: {0}'.format(DEBUG_PROFILE)) self._dataLoader = LoadData() self._config_ini = ConfigIni() self._convertFilesForm = ConvertFileForm() self._downloadDbForm = DownloadDbForm() self._attSelectForm = DataBrowserSelectAttrForm(self._config_ini) self._sent_ann_form = SentAnnotationsForm(self._config_ini) self._export_to_pdf_form = ExportToPdfForm() # self._ann_show_hide_form = AnnShowHide(self._config_ini) # dock widgets self._clinInfoWidget = ClinInfo() self._clinInfoWidget.clear_all() self.ui.dockClinInfo.setWidget(self._clinInfoWidget) self._dataBrowserWidget = DataBrowserForm() self.ui.dockDataBrowser.setWidget(self._dataBrowserWidget) self._dataBrowserWidget.plotFileSignal.connect(self.plot_file) valr = self._config_ini.get_var(EnumIniVar.annotationToolbarAlignR) self.ui.actionAnnToolbarAlign_right.setChecked(valr) self._toolbar_align() # self.ui.actionSent_annotations.setEnabled(False) self._create_connections() self._signal_data = dict() self.msgbox_unsaved = QtGui.QMessageBox() self.msgbox_unsaved.setText( "There are unsaved changes in annotations.") self.msgbox_unsaved.setInformativeText("Save now?") self.msgbox_unsaved.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard) self.msgbox_unsaved.setDefaultButton(QtGui.QMessageBox.Save) self.msgbox_unsaved.setIcon(QtGui.QMessageBox.Critical) self.msgbox_delete = QtGui.QMessageBox() self.msgbox_delete.setText("Are you sure to delele all annotations?") self.msgbox_delete.setInformativeText( "All annotations will be lost. This can't be undone.") self.msgbox_delete.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) self.msgbox_delete.setDefaultButton(QtGui.QMessageBox.Save) self.msgbox_delete.setIcon(QtGui.QMessageBox.Warning) self.msgbox_err = QtGui.QMessageBox() self.msgbox_err.setStandardButtons(QtGui.QMessageBox.Ok) self.msgbox_err.setDefaultButton(QtGui.QMessageBox.Ok) self.msgbox_err.setIcon(QtGui.QMessageBox.Critical) if self._export_to_pdf_form.reportlab_imported: self.ui.actionExport_to_PDF.setEnabled(True) else: self.ui.actionExport_to_PDF.setEnabled(False) self.ui.actionExport_to_PDF.setToolTip('Export to PDF disabled') parsed_args = self._process_cmd_args(args) # paper format self._set_paper_format(self._config_ini.get_var( EnumIniVar.paperformat)) # self._save_to_pdf2() valg = QtCore.QByteArray( self._config_ini.get_var(EnumIniVar.windowGeometry)) vals = QtCore.QByteArray( self._config_ini.get_var(EnumIniVar.windowState)) self.restoreGeometry(valg) self.restoreState(vals) if len(vals) == 0: self.ui.dockDataBrowser.setVisible(False) self.ui.dockClinInfo.setVisible(False) self.ui.toolBar.setVisible(False) self._dock_clin_info_visibility() self._dock_databrowse_visibility() self._toolbar_ann_visibility() self.ui.actionCaliper.setChecked( self._config_ini.get_var(EnumIniVar.caliperVisible)) self.ui.actionCaliperFHR.setChecked( self._config_ini.get_var(EnumIniVar.caliperFHR)) self.ui.actionCaliperTOCO.setChecked( self._config_ini.get_var(EnumIniVar.caliperTOCO)) self._caliper_set() self._debug_data = dict() if DEBUG_TOOLS is True: self.menuDebug = QtGui.QMenu(self.ui.menubar) self.menuDebug.setTitle('Debug') self.menuDebug.addAction(self.ui.actionDebug_CalibSignal) self.ui.menubar.addAction(self.menuDebug.menuAction()) # this is a tweak for batch export # this is really a hack and should be solver systematically if parsed_args.export_to_pdf is not None: # batch processing self.plot_file(parsed_args.export_to_pdf) self.show() self.ui.PlotWidget.updatePlots() self._export_to_pdf(silent=True) sys.exit(0)