Example #1
0
	def __init__( self, core ) :

		# Inherit all attributes of an instance of "QWidget".

		super( widget_mom_ctrl, 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_rset'), self.resp_rset )
		self.connect( self.core, SIGNAL('janus_chng_mom_win'),
		                                       self.resp_chng_mom_win )

		# Give this widget a grid layout, "self.grd".

		self.grd = QGridLayout( )

		self.setLayout( self.grd )

		# Initialize the text areas, buttons, and labels that comprise
		# this control panel.

		self.txt_win_dir = event_LineEdit( self, 'win_dir' )
		self.txt_win_bin = event_LineEdit( self, 'win_bin' )

		self.lab_win_dir = QLabel( 'Directions per cup:'    )
		self.lab_win_bin = QLabel( 'Bins per direction:'    )

		self.lab_win_dir.setFont( QFont( "Helvetica", 12 ) )
		self.lab_win_bin.setFont( QFont( "Helvetica", 12 ) )

		# Row by row, add the text areas, buttons, and labels to this
		# widget's grid.

		self.grd.addWidget( self.lab_win_dir, 0, 0, 1, 1 )
		self.grd.addWidget( self.txt_win_dir, 0, 1, 1, 1 )

		self.grd.addWidget( self.lab_win_bin, 1, 0, 1, 1 )
		self.grd.addWidget( self.txt_win_bin, 1, 1, 1, 1 )

		# Populate the text areas.

		self.make_txt( )
    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()
Example #3
0
	def __init__( self, core ) :

		# Inherit all attributes of an instance of "QWidget".

		super( widget_nln_spc, 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_nln_ion'),
		                                        self.resp_chng_nln_ion )

		# Give this widget a grid layout, "self.grd".

		self.grd = QGridLayout( )

		self.setLayout( self.grd )

		# |   0   |   1   |   2   |   3   |   4   |   5   |
		# +-------+-------+-------+-------+-------+-------+
		# | Name                  |  Sym  | m/m_p | q/q_p |
		# | LineEdit              | LineE | LineE | LineE |

		# Initialize the labels, check boxes, and text areas that 
		# comprise this widget.

		self.hdr_name  = QLabel( 'Species Name' )
		self.hdr_sym   = QLabel( 'Symbol'       )
		self.hdr_m     = QLabel( 'm / m_p'      )
		self.hdr_q     = QLabel( 'q / q_p'      )

		self.arr_name  = tile( None, self.core.nln_n_pop )
		self.arr_sym   = tile( None, self.core.nln_n_pop )
		self.arr_m     = tile( None, self.core.nln_n_pop )
		self.arr_q     = tile( None, self.core.nln_n_pop )

		for i in range( self.core.nln_n_spc ) :

			txt_i = str( i )

			self.arr_name[i] = event_LineEdit( self, 'n'+txt_i )
			self.arr_sym[i]  = event_LineEdit( self, 's'+txt_i )
			self.arr_m[i]    = event_LineEdit( self, 'm'+txt_i )
			self.arr_q[i]    = event_LineEdit( self, 'q'+txt_i )

		# Row by row, add the labels, check boxes, and text areas, to
		# this widget's grid.

		self.grd.addWidget( self.hdr_name, 0, 0, 1, 3 )
		self.grd.addWidget( self.hdr_sym , 0, 3, 1, 1, Qt.AlignCenter )
		self.grd.addWidget( self.hdr_m   , 0, 4, 1, 1, Qt.AlignCenter )
		self.grd.addWidget( self.hdr_q   , 0, 5, 1, 1, Qt.AlignCenter )

		for i in range( self.core.nln_n_spc ) :

			self.grd.addWidget( self.arr_name[i], i+1, 0, 1, 3 )
			self.grd.addWidget( self.arr_sym[i] , i+1, 3, 1, 1 )
			self.grd.addWidget( self.arr_m[i]   , i+1, 4, 1, 1 )
			self.grd.addWidget( self.arr_q[i]   , i+1, 5, 1, 1 )

		# Regularize the grid spacing.

		for i in range( 6 ) :
			self.grd.setColumnStretch( i, 1 )

		for i in range( self.core.nln_n_spc + 1 ) :
			self.grd.setRowStretch( i, 1 )

		# Populate the text areas.

		self.make_txt( )
Example #4
0
    def __init__(self, core):

        # Inherit all attributes of an instance of "QDialog".

        super(dialog_opt_fls, 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_opt'), self.resp_chng_opt)
        self.connect(self.core, SIGNAL('janus_rstr_opt'), self.resp_rstr_opt)

        # 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.sg = QGridLayout()

        self.sg.setContentsMargins(0, 0, 0, 0)

        self.grd.addLayout(self.sg, 0, 0, 13, 3)

        # Initialize the text boxes, buttons, and labels that comprise
        # this dialog box.

        self.lab_hdr1 = QLabel('Maximum number of saved downloaded files')
        self.lab_hdr2 = QLabel('(Use "inf" for no limit)')
        self.lab_hdr3 = QLabel('MFI Resolution')

        self.lab1 = {
            'fls_n_fc': QLabel('FC Files'),
            'fls_n_spin': QLabel('Spin Files'),
            'fls_n_mfi_l': QLabel('Low Resolution MFI Files'),
            'fls_n_mfi_h': QLabel('High Resolution MFI Files')
        }

        self.lab2 = {
            'mfi_l': QLabel('Low Resolution (0.3 Hz) ', self),
            'mfi_h': QLabel('High Resolution (11 Hz)', self)
        }

        self.arr_txt = {
            'fls_n_fc': event_LineEdit(self, 'fls_n_fc'),
            'fls_n_spin': event_LineEdit(self, 'fls_n_spin'),
            'fls_n_mfi_l': event_LineEdit(self, 'fls_n_mfi_l'),
            'fls_n_mfi_h': event_LineEdit(self, 'fls_n_mfi_h')
        }

        self.box = {
            'mfi_l': event_RadioBox(self, 'mfi_l'),
            'mfi_h': event_RadioBox(self, 'mfi_h')
        }

        self.order1 = ['fls_n_fc', 'fls_n_spin', 'fls_n_mfi_l', 'fls_n_mfi_h']

        self.order2 = ['mfi_l', 'mfi_h']

        # Row by row, add the text boxes, buttons, and labels to this
        # widget's sub-grids.

        self.lab_hdr1.setFont(QFont("Helvetica", 12))
        self.lab_hdr2.setFont(QFont("Helvetica", 12))
        self.lab_hdr3.setFont(QFont("Helvetica", 12))

        self.sg.addWidget(self.lab_hdr1, 0, 0, 1, 3)
        self.sg.addWidget(self.lab_hdr2, 1, 0, 1, 3)

        for i, key in enumerate(self.order1):

            self.lab1[key].setFont(QFont("Helvetica", 12))
            self.arr_txt[key].setFont(QFont("Helvetica", 12))

            self.sg.addWidget(self.lab1[key], 2 + i, 0, 1, 1)
            self.sg.addWidget(self.arr_txt[key], 2 + i, 1, 1, 1)
            self.arr_txt[key].setMaximumWidth(60)

        self.lab_hdr3.setFont(QFont("Helvetica", 12, QFont.Bold))
        self.sg.addWidget(self.lab_hdr3, 6, 0, 1, 3)

        for i, key in enumerate(self.order2):

            self.lab2[key].setFont(QFont("Helvetica", 12))
            self.box[key].setFont(QFont("Helvetica", 12))

            self.sg.addWidget(self.lab2[key], 7 + i, 0, 1, 1)
            self.sg.addWidget(self.box[key], 7 + i, 1, 1, 1)

        # Populate the menu with the options settings from core.

        self.make_opt()
Example #5
0
    def __init__(self, core):

        # Inherit all attributes of an instance of "QWidget".

        super(widget_nln_gss, 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_rset'), self.resp_rset)
        self.connect(self.core, SIGNAL('janus_chng_nln_ion'),
                     self.resp_chng_nln_ion)
        self.connect(self.core, SIGNAL('janus_chng_nln_gss'),
                     self.resp_chng_nln_gss)

        # Give this widget a grid layout, "self.grd".

        self.grd = QGridLayout()

        self.setLayout(self.grd)

        # Initialize the labels, check boxes, and text areas that
        # comprise this widget.

        self.hdr_name = QLabel('Ion Population')
        self.hdr_n = QLabel('n [cm^-3]')
        self.hdr_d = QLabel('dv [km/s]')
        self.hdr_w = QLabel('w [km/s]')

        self.hline = QFrame()
        self.hline.setFrameStyle(QFrame.HLine)
        self.hline.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.vel_lab = QLabel('v_vec [km/s]: ')
        self.vel_x = event_LineEdit(self, 'vx')
        self.vel_y = event_LineEdit(self, 'vy')
        self.vel_z = event_LineEdit(self, 'vz')

        self.arr_name = tile(None, self.core.nln_n_pop)
        self.arr_n = tile(None, self.core.nln_n_pop)
        self.arr_d = tile(None, self.core.nln_n_pop)
        self.arr_ws = tile(None, self.core.nln_n_pop)
        self.arr_we = tile(None, self.core.nln_n_pop)
        self.arr_wa = tile(None, self.core.nln_n_pop)

        for i in range(self.core.nln_n_pop):

            txt_i = str(i)

            self.arr_name[i] = QLabel('')
            self.arr_n[i] = event_LineEdit(self, 'nn' + txt_i)
            self.arr_d[i] = event_LineEdit(self, 'dd' + txt_i)
            self.arr_ws[i] = event_LineEdit(self, 'ws' + txt_i)
            self.arr_we[i] = event_LineEdit(self, 'we' + txt_i)
            self.arr_wa[i] = event_LineEdit(self, 'wa' + txt_i)

        # Row by row, add the labels, check boxes, and text areas, to
        # this widget's grid.

        self.grd.addWidget(self.hdr_name, 0, 0, 1, 4)
        self.grd.addWidget(self.hdr_n, 0, 4, 1, 2, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_d, 0, 6, 1, 2, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_w, 0, 8, 1, 4, Qt.AlignCenter)

        for i in range(self.core.nln_n_pop):

            self.grd.addWidget(self.arr_name[i], i + 1, 0, 1, 4)
            self.grd.addWidget(self.arr_n[i], i + 1, 4, 1, 2)
            self.grd.addWidget(self.arr_d[i], i + 1, 6, 1, 2)
            self.grd.addWidget(self.arr_ws[i], i + 1, 9, 1, 2)
            self.grd.addWidget(self.arr_wa[i], i + 1, 8, 1, 2)
            self.grd.addWidget(self.arr_we[i], i + 1, 10, 1, 2)

        i = self.core.nln_n_pop + 1

        self.grd.addWidget(self.hline, i, 0, 1, 12)

        i = self.core.nln_n_pop + 2

        self.grd.addWidget(self.vel_lab, i, 0, 1, 4, Qt.AlignRight)
        self.grd.addWidget(self.vel_x, i, 4, 1, 2, Qt.AlignCenter)
        self.grd.addWidget(self.vel_y, i, 6, 1, 2, Qt.AlignCenter)
        self.grd.addWidget(self.vel_z, i, 8, 1, 2, Qt.AlignCenter)

        # Regularize the grid spacing.

        for i in range(12):
            self.grd.setColumnStretch(i, 1)

        for i in range(self.core.nln_n_pop + 3):
            self.grd.setRowStretch(i, 1)

        # Populate the text areas.

        self.make_txt()
Example #6
0
    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
Example #7
0
    def __init__(self, core):

        # Inherit all attributes of an instance of "QWidget".

        super(widget_nln_set, 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_nln_ion'),
                     self.resp_chng_nln_ion)
        self.connect(self.core, SIGNAL('janus_chng_nln_set'),
                     self.resp_chng_nln_set)

        # Give this widget a grid layout, "self.grd".

        self.grd = QGridLayout()

        self.setLayout(self.grd)

        # Initialize the labels, check boxes, and text areas that
        # comprise this widget.

        # |   0   |   1   |   2   |   3   |   4   |   5   |   6   |
        # +-------+-------+-------+-------+-------+-------+-------+
        # | Name          |   init. guess ctrl.   | select ctrl.  |
        # |               |   n   |   v   |   w   | w_min | w_max |
        # | QLabel        | LineE | LineE | LineE | LineE | LineE |

        self.hdr_name = QLabel('Ion Population')
        self.hdr_gss = QLabel('Initial-Guess Generation')
        self.hdr_sel = QLabel('Data Selection')

        self.hdr_gss_n = QLabel('n/n_m')
        self.hdr_gss_d = QLabel('dv/v_m')
        self.hdr_gss_w = QLabel('w/w_m')

        self.hdr_sel_a = QLabel('w_-/w')
        self.hdr_sel_b = QLabel('w_+/w')

        self.arr_name = tile(None, self.core.nln_n_pop)
        self.arr_gss_n = tile(None, self.core.nln_n_pop)
        self.arr_gss_d = tile(None, self.core.nln_n_pop)
        self.arr_gss_w = tile(None, self.core.nln_n_pop)
        self.arr_sel_a = tile(None, self.core.nln_n_pop)
        self.arr_sel_b = tile(None, self.core.nln_n_pop)

        for i in range(self.core.nln_n_pop):

            txt_i = str(i)

            self.arr_name[i] = QLabel('')
            self.arr_gss_n[i] = event_LineEdit(self, 'gn' + txt_i)
            self.arr_gss_w[i] = event_LineEdit(self, 'gw' + txt_i)
            self.arr_sel_a[i] = event_LineEdit(self, 's-' + txt_i)
            self.arr_sel_b[i] = event_LineEdit(self, 's+' + txt_i)

            if (i != 0):
                self.arr_gss_d[i] =\
                              event_LineEdit( self, 'gd'+txt_i )

        # Row by row, add the labels, check boxes, and text areas, to
        # this widget's grid.

        self.grd.addWidget(self.hdr_name, 0, 0, 2, 2)
        self.grd.addWidget(self.hdr_gss, 0, 2, 1, 3, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_sel, 0, 5, 1, 2, Qt.AlignCenter)

        self.grd.addWidget(self.hdr_gss_n, 1, 2, 1, 1, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_gss_d, 1, 3, 1, 1, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_gss_w, 1, 4, 1, 1, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_sel_a, 1, 5, 1, 1, Qt.AlignCenter)
        self.grd.addWidget(self.hdr_sel_b, 1, 6, 1, 1, Qt.AlignCenter)

        for i in range(self.core.nln_n_pop):

            if (self.arr_name[i] is not None):
                self.grd.addWidget(self.arr_name[i], (i + 2), 0, 1, 2)

            if (self.arr_gss_n[i] is not None):
                self.grd.addWidget(self.arr_gss_n[i], (i + 2), 2, 1, 1)

            if (self.arr_gss_d[i] is not None):
                self.grd.addWidget(self.arr_gss_d[i], (i + 2), 3, 1, 1)

            if (self.arr_gss_w[i] is not None):
                self.grd.addWidget(self.arr_gss_w[i], (i + 2), 4, 1, 1)

            if (self.arr_sel_a[i] is not None):
                self.grd.addWidget(self.arr_sel_a[i], (i + 2), 5, 1, 1)

            if (self.arr_sel_b[i] is not None):
                self.grd.addWidget(self.arr_sel_b[i], (i + 2), 6, 1, 1)

        # Regularize the grid spacing.

        for i in range(7):
            self.grd.setColumnStretch(i, 1)

        for i in range(self.core.nln_n_pop + 2):
            self.grd.setRowStretch(i, 1)

        # Populate the text areas.

        self.make_txt()