def __init__(self, core): # Inherit all attributes of an instance of "QWidget". super(widget_ctrl_save, self).__init__() # Store the Janus core. self.core = core # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.setLayout(self.grd) # Initialize the buttons that comprise this control panel. self.btn_save = event_PushButton(self, 'save', 'Save') self.btn_xprt = event_PushButton(self, 'xprt', 'Export') self.btn_rstr = event_PushButton(self, 'rstr', 'Restore') # Add the buttons to this widget's grid. self.grd.addWidget(self.btn_save, 0, 0, 1, 1) self.grd.addWidget(self.btn_xprt, 0, 1, 1, 1) self.grd.addWidget(self.btn_rstr, 0, 2, 1, 1)
def __init__(self, core): # Inherit all attributes of an instance of "QWidget". super(widget_ctrl_run, self).__init__() # Store the Janus core. self.core = core # Prepare to respond to signals received from the Janus core. self.connect(self.core, SIGNAL('janus_chng_spc'), self.resp_chng_spc) self.connect(self.core, SIGNAL('janus_done_auto_run'), self.resp_done_auto_run) # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.setLayout(self.grd) # Initialize the primary buttons. self.btn_mom = event_PushButton(self, 'mom', 'Moments') self.btn_nln = event_PushButton(self, 'nln', 'Non-Linear') self.btn_opt = event_PushButton(self, 'opt', 'Options') self.btn_auto = event_PushButton(self, 'auto', 'Auto-Run') # Initialize and configure the stop button. self.btn_stop = event_PushButton(self, 'stop', 'Stop') self.btn_stop.setStyleSheet('QPushButton {color:red}') self.btn_stop.setVisible(False) # Add the buttons to this widget's grid. self.grd.addWidget(self.btn_stop, 1, 1, 1, 1) self.grd.addWidget(self.btn_mom, 0, 0, 1, 1) self.grd.addWidget(self.btn_nln, 0, 1, 1, 1) self.grd.addWidget(self.btn_opt, 1, 0, 1, 1) self.grd.addWidget(self.btn_auto, 1, 1, 1, 1) # Intialize the variables that will store the user's last # requested settings for the automatic analysis. self.req_auto_strt = '' self.req_auto_stop = '' self.req_auto_next = False self.req_auto_halt = True # Initialize the variable that will hold the progress-bar dialog # (if an when one is created). self.dia_prog = None
def __init__(self, core): # Inherit all attributes of an instance of "QDialog". super(dialog_opt, self).__init__() # Store the Janus core. self.core = core # Make this a modal dialog (i.e., block user-interaction with # the main application window while this dialog exists). self.setModal(True) # Set the title of this dialog window. self.setWindowTitle('Options Menu') # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.grd.setContentsMargins(6, 6, 6, 6) self.setLayout(self.grd) # Add a QTabWidget. self.wdg = QTabWidget() self.sg = QGridLayout() self.grd.addWidget(self.wdg, 0, 0, 1, 1) self.grd.addLayout(self.sg, 2, 0, 1, 1) self.wdg_opt_par = dialog_opt_par(self.core) self.wdg_opt_fls = dialog_opt_fls(self.core) self.wdg.addTab(self.wdg_opt_par, 'Results') self.wdg.addTab(self.wdg_opt_fls, 'File Options') self.btn_rstr = event_PushButton(self, 'rstr', 'Restore Default') self.btn_close = event_PushButton(self, 'close', 'Close') self.btn_rstr.setAutoDefault(False) self.btn_close.setAutoDefault(False) self.sg.addWidget(self.btn_rstr, 1, 0, 1, 1) self.sg.addWidget(self.btn_close, 1, 1, 1, 1) # Execute this dialog. self.exec_()
def __init__( self ) : # Inherit all attributes of an instance of "QDialog". super( dialog_save, self ).__init__( ) # Make this a modal dialog (i.e., block user-interaction with # the main application window while this dialog exists). self.setModal( True ) # Set the title of this dialog window. self.setWindowTitle( 'Save?' ) # Give this widget a grid layout, "self.grd". self.grd = QGridLayout( ) self.grd.setContentsMargins( 6, 6, 6, 6 ) self.setLayout( self.grd ) # Initialize the label and buttons that comprise this dialog # box. self.lab = QLabel( 'Save analysis results before exit?' ) self.btn_save = event_PushButton( self, 'save', 'Save' ) self.btn_xprt = event_PushButton( self, 'xprt', 'Export' ) self.btn_exit = event_PushButton( self, 'exit', 'Discard' ) self.btn_cncl = event_PushButton( self, 'cncl', 'Cancel' ) # Add the label and the buttons to the grid layout. self.grd.addWidget( self.lab , 0, 0, 1, 3 ) self.grd.addWidget( self.btn_save, 1, 0, 1, 1 ) self.grd.addWidget( self.btn_exit, 1, 1, 1, 1 ) self.grd.addWidget( self.btn_cncl, 1, 2, 1, 1 ) ###self.grd.addWidget( self.lab , 0, 0, 1, 4 ) ###self.grd.addWidget( self.btn_save, 1, 0, 1, 1 ) ###self.grd.addWidget( self.btn_xprt, 1, 1, 1, 1 ) ###self.grd.addWidget( self.btn_exit, 1, 2, 1, 1 ) ###self.grd.addWidget( self.btn_cncl, 1, 3, 1, 1 ) # Initialize the object to be returned to the user on the close # of this dialog window. self.resp = None
def __init__(self, core): # Inherit all attributes of an instance of "QWidget". super(widget_ctrl_time, self).__init__() # Store the Janus core. self.core = core # Prepare to respond to signals received from the Janus core. self.connect(self.core, SIGNAL('janus_chng_spc'), self.resp_chng_spc) # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.setLayout(self.grd) # Initialize the text areas and buttons that comprise this # control panel. self.txt_timestp = event_LineEdit(self, 'goto') self.btn_goto_sp = event_PushButton(self, 'goto', 'Go') self.btn_prev_hr = event_PushButton(self, '-1hr', '<<') self.btn_prev_sp = event_PushButton(self, '-1sp', '<') self.btn_next_sp = event_PushButton(self, '+1sp', '>') self.btn_next_hr = event_PushButton(self, '+1hr', '>>') # Row by row, add the text areas and buttons to this widget's # grid. self.grd.addWidget(self.txt_timestp, 0, 0, 1, 3) self.grd.addWidget(self.btn_goto_sp, 0, 3, 1, 1) self.grd.addWidget(self.btn_prev_hr, 1, 0, 1, 1) self.grd.addWidget(self.btn_prev_sp, 1, 1, 1, 1) self.grd.addWidget(self.btn_next_sp, 1, 2, 1, 1) self.grd.addWidget(self.btn_next_hr, 1, 3, 1, 1) # Populate the text area. self.make_txt()
def __init__(self, time_strt, time_stop): # Inherit all attributes of an instance of "QDialog". super(dialog_auto_prog, self).__init__() # Make this a non-modal dialog (i.e., allow the user to still # interact with the main application window). self.setModal(False) # Set the title of this dialog window. self.setWindowTitle('Progress') # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.grd.setContentsMargins(6, 6, 6, 6) self.setLayout(self.grd) # Initialize the progress bar and set its minimum, maximum, and # initial values. self.bar = QProgressBar() self.bar.setMinimum(calc_time_val(time_strt)) self.bar.setMaximum(calc_time_val(time_stop)) self.bar.setValue(self.bar.minimum()) # Initialize the event button. self.btn_exit = event_PushButton(self, 'exit', 'Close') # Initialize the label. self.lab = QLabel('Note: closing this window will *NOT* ' + 'interrupt the automated analysis.') self.lab.setWordWrap(True) # Row by row, add the bar and buttons to the grid layout. self.grd.addWidget(self.bar, 0, 0, 1, 1) self.grd.addWidget(self.btn_exit, 0, 1, 1, 1) self.grd.addWidget(self.lab, 1, 0, 1, 2) # Display this dialog. self.show()
def __init__( self ) : # Inherit all attributes of an instance of "QDialog". super( dialog_missing, self ).__init__( ) # Make this a modal dialog (i.e., block user-interaction with # the main application window while this dialog exists). self.setModal( True ) # Set the title of this dialog window. self.setWindowTitle( 'Unimplemented Feature' ) # Give this widget a grid layout, "self.grd". self.grd = QGridLayout( ) self.grd.setContentsMargins( 6, 6, 6, 6 ) self.setLayout( self.grd ) # Initialize this dialog's label and button. self.lab = QLabel( 'The requested feature has not yet been ' + 'implemented in this version of Janus.' ) self.btn = event_PushButton( self, 'ok', 'OK' ) # Set a minimum sizes and enable word-wrap on the label. self.lab.setMinimumWidth( 300 ) self.btn.setMinimumWidth( 100 ) self.lab.setWordWrap( True ) # Add the label and button to the grid. self.grd.addWidget( self.lab, 0, 0, 1, 3 ) self.grd.addWidget( self.btn, 1, 1, 1, 1 ) # Regularize the column widths. self.grd.setColumnStretch( 0, 1 ) self.grd.setColumnStretch( 1, 1 ) self.grd.setColumnStretch( 2, 1 )
def __init__(self, time_strt='', time_stop='', get_next=False, err_halt=True): # Inherit all attributes of an instance of "QDialog". super(dialog_auto_ctrl, self).__init__() # Make this a modal dialog (i.e., block user-interaction with # the main application window while this dialog exists). self.setModal(True) # Set the title of this dialog window. self.setWindowTitle('Range of Spectra') # Give this widget a grid layout, "self.grd". self.grd = QGridLayout() self.grd.setContentsMargins(6, 6, 6, 6) self.setLayout(self.grd) # Create the sub-grids and add them to the widget's main grid. self.sg1 = QGridLayout() self.sg2 = QGridLayout() self.sg1.setContentsMargins(0, 0, 0, 0) self.sg2.setContentsMargins(0, 0, 0, 0) self.grd.addLayout(self.sg1, 0, 0, 1, 1) self.grd.addLayout(self.sg2, 1, 0, 1, 1) # Initialize the text boxes, buttons, and labels that comprise # this dialog box. self.lab_strt = QLabel('Start:') self.lab_stop = QLabel('Stop:') self.lab_next = QLabel('Begin with next:') self.lab_halt = QLabel('Halt on NLN error:') self.txt_strt = event_LineEdit(self, 'strt') self.txt_stop = event_LineEdit(self, 'stop') self.box_next = event_CheckBox(self, 'next') self.box_halt = event_CheckBox(self, 'halt') self.btn_auto = event_PushButton(self, 'auto', 'Auto-Run') self.btn_cncl = event_PushButton(self, 'cncl', 'Cancel') # Set a minimum size for the text boxes. self.txt_strt.setMinimumWidth(150) self.txt_stop.setMinimumWidth(150) # Adjust the button defaults. self.btn_auto.setDefault(False) self.btn_cncl.setDefault(False) self.btn_auto.setAutoDefault(False) self.btn_cncl.setAutoDefault(False) # Row by row, add the text boxes, buttons, and labels to this # widget's sub-grids. self.sg1.addWidget(self.lab_strt, 0, 0, 1, 1) self.sg1.addWidget(self.txt_strt, 0, 1, 1, 1) self.sg1.addWidget(self.lab_next, 0, 2, 1, 1) self.sg1.addWidget(self.box_next, 0, 3, 1, 1) self.sg1.addWidget(self.lab_stop, 1, 0, 1, 1) self.sg1.addWidget(self.txt_stop, 1, 1, 1, 1) self.sg1.addWidget(self.lab_halt, 1, 2, 1, 1) self.sg1.addWidget(self.box_halt, 1, 3, 1, 1) self.sg2.addWidget(self.btn_auto, 0, 0, 1, 1) self.sg2.addWidget(self.btn_cncl, 0, 1, 1, 1) # Initialize the requested start and stop timestamps using the # user-provided values (if any). # Note. The call of "self.aply_time" below initializes the # "self.time_????" and "self.vld_????" parameters and # populates the text boxes approriately. self.aply_time(time_strt=time_strt, time_stop=time_stop, get_next=get_next, err_halt=err_halt) # Select (i.e., highlight) any and all text in the text box for # the start time. # Note. By highlighting this text, the user can more easily # delete any default start time that may have been # provided (via the "time_strt" argument of this # function). self.txt_strt.selectAll() # Initialize the object to be returned to the user on the close # of this dialog window. # Note. The value of "self.ret" should only ever be changed to # something other than "None" in response to the "auto" # button being pressed (or an equivalent action). self.ret = None