def __init__(self, parameters, parent = None): QtGui.QMainWindow.__init__(self, parent) # General. self.directory = "" self.parameters = parameters self.command_index = 0 self.commands = [] self.disk_usages = [] self.command_durations = [] self.is_command_valid = [] self.notifier = notifications.Notifier("", "", "", "") self.running = False self.settings = QtCore.QSettings("Zhuang Lab", "dave") self.sequence_filename = "" self.sequence_validated = False self.test_mode = False self.skip_warning = False self.needs_hal = False self.needs_kilroy = False self.createGUI() # Movie engine. self.command_engine = CommandEngine() self.command_engine.done.connect(self.handleDone) self.command_engine.problem.connect(self.handleProblem) self.command_engine.paused.connect(self.handlePauseFromCommandEngine) self.updateGUI()
def __init__(self, parameters, parent=None): QtGui.QMainWindow.__init__(self, parent) # General. self.directory = "" self.parameters = parameters self.notifier = notifications.Notifier("", "", "", "") self.running = False self.settings = QtCore.QSettings("Zhuang Lab", "dave") self.sequence_filename = "" self.sequence_validated = False self.test_mode = False self.skip_warning = False self.needs_hal = False self.needs_kilroy = False # UI setup. self.ui = daveUi.Ui_MainWindow() self.ui.setupUi(self) self.ui.remainingLabel.setText("") self.ui.sequenceLabel.setText("") self.ui.spaceLabel.setText("") self.ui.timeLabel.setText("") # Hide widgets self.ui.frequencyLabel.hide() self.ui.frequencySpinBox.hide() self.ui.statusMsgCheckBox.hide() # Set icon. self.setWindowIcon(QtGui.QIcon("dave.ico")) # This is for handling file drops. self.ui.centralwidget.__class__.dragEnterEvent = self.dragEnterEvent self.ui.centralwidget.__class__.dropEvent = self.dropEvent # Connect UI signals. self.ui.abortButton.clicked.connect(self.handleAbortButton) self.ui.actionNew_Sequence.triggered.connect( self.handleNewSequenceFile) self.ui.actionQuit.triggered.connect(self.quit) self.ui.actionGenerateXML.triggered.connect(self.handleGenerateXML) self.ui.actionSendTestEmail.triggered.connect(self.handleSendTestEmail) self.ui.commandSequenceTreeView.update.connect( self.handleDetailsUpdate) self.ui.fromAddressLineEdit.textChanged.connect( self.handleNotifierChange) self.ui.fromPasswordLineEdit.textChanged.connect( self.handleNotifierChange) self.ui.runButton.clicked.connect(self.handleRunButton) self.ui.smtpServerLineEdit.textChanged.connect( self.handleNotifierChange) self.ui.toAddressLineEdit.textChanged.connect( self.handleNotifierChange) self.ui.validateSequenceButton.clicked.connect( self.handleValidateCommandSequence) self.ui.commandSequenceTreeView.double_clicked.connect( self.handleDoubleClick) self.ui.currentWarnings.double_clicked.connect( self.handleWarningsDoubleClick) self.ui.clearWarningsPushButton.clicked.connect( self.handleClearWarnings) # Load saved notifications settings. self.noti_settings = [[self.ui.fromAddressLineEdit, "from_address"], [self.ui.fromPasswordLineEdit, "from_password"], [self.ui.smtpServerLineEdit, "smtp_server"]] for [object, name] in self.noti_settings: object.setText(self.settings.value(name, "").toString()) # Configure command details table. #self.ui.commandTableView.setHeaderHidden(True) # Set enabled/disabled status self.ui.runButton.setEnabled(False) self.ui.abortButton.setEnabled(False) self.ui.validateSequenceButton.setEnabled(False) # Initialize progress bar self.ui.progressBar.setValue(0) self.ui.progressBar.setMinimum(0) self.ui.progressBar.setMaximum(1) # Command engine. self.command_engine = CommandEngine() self.command_engine.done.connect(self.handleDone) self.command_engine.problem.connect(self.handleProblem) self.command_engine.paused.connect(self.handlePauseFromCommandEngine) self.command_engine.warning.connect(self.handleWarning) self.command_engine.dave_action.connect(self.handleDaveAction)