Пример #1
0
 def __init__(self, parent=None, filter_column_index=None):
     """ """
     QtWidgets.QTableView.__init__(self, parent)
     self._tablemodel = ToolboxTableModel(modeldata=DatasetTable())
     self._selectionmodel = None  # Created below.
     # Connect models.
     if filter_column_index is None:
         self.setModel(self._tablemodel)
         #
         self._selectionmodel = QtCore.QItemSelectionModel(self._tablemodel)
         self.setSelectionModel(self._selectionmodel)
         self.resizeColumnsToContents()
     else:
         """ Use this method if the default model should be replaced by a filtered model. """
         # Filter proxy model.
         self.filterproxymodel = QtCore.QSortFilterProxyModel(self)
         self.filterproxymodel.setSourceModel(self._tablemodel)
         self.filterproxymodel.setFilterKeyColumn(filter_column_index)
         self.setModel(self.filterproxymodel)
         #
         self._selectionmodel = QtCore.QItemSelectionModel(
             self.filterproxymodel)
         self.setSelectionModel(self._selectionmodel)
         self.resizeColumnsToContents()
     # Default setup for tables.
     self.setAlternatingRowColors(True)
     self.setHorizontalScrollMode(
         QtWidgets.QAbstractItemView.ScrollPerPixel)
Пример #2
0
    def delete_row(self):

        reply = QtWidgets.QMessageBox.question(
            self, "Demande de suppression",
            "Êtes-vous sûr de vouloir supprimer l'opération ?",
            QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.Yes:
            l = self.tableView.currentIndex().row()
            print("ligne")
            print(l)
            selection = QtCore.QItemSelectionModel(self.model)
            index = selection.currentIndex()
            if self.model.removeRows(l, 1, index):
                self.model.submitAll()
                print("ok suppression")
                QMessageBox.information(self, "Succès",
                                        "Suppression avec succès")
                self.initialise()

            else:
                QMessageBox.information(self, "Erreur",
                                        "Erreur suppression attribut")

        else:
            reply.close(self)
Пример #3
0
    def __init__(self, window):
        Ui_MainWindow.__init__(self)
        self.setupUi(window)
        self.pushButton_connect.clicked.connect(self.ConnectServer)
        # self.ui.closeEvent = self.closeEvent
        window.closeEvent = self.closeEvent
        self.model = QtGui.QStandardItemModel(self.listView_clients)
        self.listView_clients.setModel(self.model)
        self.selectmodel = QtCore.QItemSelectionModel()
        self.selectmodel.flags = QtCore.QItemSelectionModel.ClearAndSelect
        self.listView_clients.setSelectionModel(self.selectmodel)
        self.listView_clients.selectionModel().selectionChanged.connect(self.selectClientChanges)

        # adjust sizes
        '''
        self.pushButton_30.adjustSize()
        self.pushButton_60.adjustSize()
        self.pushButton_connect.adjustSize()
        self.pushButton_minShutdown.adjustSize()
        self.pushButton_refresh_clients.adjustSize()
        self.pushButton_stop.adjustSize()
        self.pushButton_remote_sd_custom.adjustSize()
        self.pushButton_remote_sd_now.adjustSize()
        self.pushButton_remote_sd_stop.adjustSize()
        '''
        sett=self.tryLoadSettings()
        self.lineEdit_clientName.setText(str(sett).strip())
        self.lineEdit_clientName.returnPressed.connect(self.writeSettings)

        print(sett)
        # handle close application
        self.pushButton_exit.clicked.connect(self.SafeCleanUp)

        self.label_status.setText("Disconnected")
        self.label_status.setStyleSheet(("QLabel {  color : red; }"))

        # local buttons
        self.pushButton_30.clicked.connect(lambda: self.setLocalShutDown(30 * 60))
        self.pushButton_60.clicked.connect(lambda: self.setLocalShutDown(60 * 60))
        self.pushButton_minShutdown.clicked.connect(lambda: self.setLocalShutDown(-1))
        self.pushButton_stop.clicked.connect(self.stopPendingShutdown)

        # remote buttons
        self.pushButton_remote_sd_now.clicked.connect(lambda: self.sendRemoteShutdown(0))
        self.pushButton_remote_sd_custom.clicked.connect(lambda: self.sendRemoteShutdown(-1))
        self.pushButton_remote_sd_stop.clicked.connect(self.sendRemotestopPending)

        # Loop thread
        self.loopthread = LoopThread(self)
        self.loopthread.start()

        # just to be safe
        r = os.system("shutdown -a")
        if r == 0:
            self.displayInfoBox("Im sorry. I had to stop scheduled operation.")

        # remote clients buttons
        self.enableRemoteClientCommands(False)
Пример #4
0
    def __init__(self):
        QtWidgets.QWidget.__init__(self)

        self.stringListModel = QtCore.QStringListModel()

        self.doneSelectionModel = QtCore.QItemSelectionModel()
        self.doneSelectionModel.setModel(self.stringListModel)

        self.checkableProxy = KItemModels.KCheckableProxyModel()
        self.checkableProxy.setSourceModel(self.stringListModel)
        self.checkableProxy.setSelectionModel(self.doneSelectionModel)

        mainlayout = QtWidgets.QHBoxLayout(self)

        todoLayout = QtWidgets.QVBoxLayout(self)
        mainlayout.addLayout(todoLayout)

        todoLayout.addWidget(QtWidgets.QLabel("TODO list"))

        addLayout = QtWidgets.QHBoxLayout(self)
        todoLayout.addLayout(addLayout)
        self.addLineEdit = QtWidgets.QLineEdit()
        addLayout.addWidget(self.addLineEdit)
        self.addButton = QtWidgets.QPushButton("Add")
        addLayout.addWidget(self.addButton)
        self.addButton.clicked.connect(self.add_todo)
        self.addLineEdit.returnPressed.connect(self.add_todo)

        self.stringsView = QtWidgets.QTreeView()
        self.stringsView.header().hide()
        self.stringsView.setModel(self.checkableProxy)
        self.stringsView.setSelectionMode(
            QtWidgets.QTreeView.ExtendedSelection)
        todoLayout.addWidget(self.stringsView)

        self.selectionProxy = KItemModels.KSelectionProxyModel()
        self.selectionProxy.setSourceModel(self.stringListModel)
        self.selectionProxy.setSelectionModel(self.doneSelectionModel)

        l = QtWidgets.QVBoxLayout(self)
        mainlayout.addLayout(l)

        l.addWidget(QtWidgets.QLabel("DONE list"))

        self.selectionView = QtWidgets.QTreeView()
        self.selectionView.header().hide()
        self.selectionView.setModel(self.selectionProxy)
        l.addWidget(self.selectionView)

        statusLayout = QtWidgets.QHBoxLayout(self)
        l.addLayout(statusLayout)

        self.ratingWidget = KWidgetsAddons.KLed()
        statusLayout.addWidget(self.ratingWidget)

        self.statusText = QtWidgets.QLabel("Status: Ok")
        statusLayout.addWidget(self.statusText)
Пример #5
0
    def setTableModel(self, tablemodeldata):
        """ """
        if self._tablemodel:
            self._tablemodel.beginResetModel()
            self._tablemodel.setModeldata(tablemodeldata)
            self._tablemodel.endResetModel()

            self._selectionmodel = QtCore.QItemSelectionModel(self._tablemodel)
            self.setSelectionModel(self._selectionmodel)
            self.resizeColumnsToContents()
Пример #6
0
    def Window(self):
        #make data into some qobject referring to pandas?
        #self.picpage=stack.widget(picin) #gets the page if data transmission needed between, like selected indices
        #print(self.picpage)

        self.view = QTableView()
        self.view.setSelectionBehavior(
            QAbstractItemView.SelectRows)  #selects rows
        self.view.setSelectionMode(
            QAbstractItemView.MultiSelection
        )  #each selection is toggles whether item is in selection - don't need to hold down shift
        #self.view.setSortingEnabled(True)

        self.view.setMinimumWidth(400)
        self.view.setMaximumWidth(700)

        self.sel = QtCore.QItemSelectionModel()
        self.layout.addWidget(self.view, 1, 0)

        self.catbx = CategoryBox()
        self.catbx.setToolTip("Choose which categories of tags to print")

        self.catbx.selectedChanged.connect(self.catfn)
        self.layout.addWidget(self.catbx, 0, 1)

        self.des = QPushButton(text='Deselect All')
        self.des.clicked.connect(lambda: self.view.selectionModel().reset(
        ))  #make it so this appears and disappears based on selection
        self.des.clicked.connect(self.selectfn)
        self.des.setHidden(True)
        self.layout.addWidget(self.des, 2, 1)

        self.csv = QPushButton(text="Locate CSV")
        self.layout.addWidget(self.csv, 3, 0)
        self.csv.clicked.connect(lambda: locatefn(typ='csv', parent=self)
                                 )  #connect to openfilewindow -> parse somehow

        self.db = QPushButton(text="Locate DB")
        self.layout.addWidget(self.db, 2, 0)
        self.db.clicked.connect(lambda: locatefn(typ='db', parent=self)
                                )  #connect to openfilewindow -> parse somehow

        self.sw = QPushButton(
            "Print Tags")  #make only appear if tags are selected,
        self.sw.setHidden(True)
        self.sw.clicked.connect(self.switchfn)
        self.sw.setFixedHeight(80)
        self.layout.addWidget(self.sw, 1, 1)
        self.sw.sizePolicy().setRetainSizeWhenHidden(True)
Пример #7
0
    def initModel(self, host):
        nodes = self.model.initModel(host)

        for node in nodes:
            data = ""
            if (node.value[0] != None):
                data = node.value[0].decode('UTF-8')
                self.appendChildRow(self.rootitem, node.name, data)

        self.sti.removeRows(1, self.rootitem.rowCount())
        self.sti.appendRow([self.rootitem])
        self.sti.setHorizontalHeaderLabels([host, 'data'])
        self.setModel(self.sti)
        self.setSelectionModel(QtCore.QItemSelectionModel())
        self.selectionModel().selectionChanged.connect(self.selectPath)
        self.expanded.connect(self.itemExpand)
        self.sti.itemChanged.connect(self.itemChanged)
        self.setColumnWidth(0, 500)
Пример #8
0
    def __init__(self, api: Api, main_window: QtWidgets.QMainWindow) -> None:
        super().__init__(main_window)
        model = AssStylesModel(self, api.subs.styles)
        selection_model = QtCore.QItemSelectionModel(model)

        self._style_list = _StyleList(api, model, selection_model, self)
        self._style_editor = _StyleEditor(api, model, selection_model, self)
        self._style_editor.setEnabled(False)
        self._preview_box = _StylePreview(api, model, selection_model, self)
        self._preview_box.preview_text_changed.connect(self._sync_preview_text)

        layout = QtWidgets.QHBoxLayout(self)
        layout.addWidget(self._style_list)
        layout.addWidget(self._style_editor)
        layout.addWidget(self._preview_box)

        self.setWindowTitle("Styles manager")

        self._sync_preview_text()
Пример #9
0
    def edit(self):
        reply = QtWidgets.QMessageBox.question(self, "Demande de modification","Êtes-vous sûr de vouloir modifier l'employé ?",
        QtWidgets.QMessageBox.Yes,
        QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.Yes:
            row = self.model.rowCount()
            selection = QtCore.QItemSelectionModel(self.model)
            index = selection.currentIndex()

            if  self.model.insertRow(row,index):
                self.model.submitAll()
                print("ok edit")
                QMessageBox.information(self, "Succès","Modification avec succès")
                self.initialise()
            else:
                QMessageBox.information(self, "Erreur","Erreur modification attribut")
        else:
                reply.close(self)
Пример #10
0
def main():
    app = QtWidgets.QApplication(sys.argv)

    stringListModel = QtCore.QStringListModel([
        "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
        "Sunday"
    ])

    selectionModel = QtCore.QItemSelectionModel()
    selectionModel.setModel(stringListModel)

    selectionProxy = KItemModels.KSelectionProxyModel()
    selectionProxy.setSelectionModel(selectionModel)
    selectionProxy.setSourceModel(stringListModel)

    assert (selectionProxy.rowCount() == 0)

    selectionModel.select(stringListModel.index(0, 0),
                          QtCore.QItemSelectionModel.Select)

    assert (selectionProxy.rowCount() == 1)
Пример #11
0
    def changePathFindFolder(self, thePath):
        # self.textboxValue = self.windowNew.inputText.text()
        # QtWidgets.QMessageBox.question(self, 'Message - pythonspot.com', "You typed: " + textboxValue, QMessageBox.Ok, QMessageBox.Ok)
        # self.windowNew.inputText.setText("")

        path = str(thePath)
        self.model = QtWidgets.QFileSystemModel()
        self.model.setRootPath((QtCore.QDir.rootPath()))
        filters = ["*.jpg", "*.JPG", "*.jpeg", "*.JPEG", "*.png", "*.PNG"]
        self.model.setNameFilters(filters)
        self.model.setNameFilterDisables(False)
        self.model.setReadOnly(True)

        self.indexRoot = self.model.index(path)

        self.windowNew.filemanager.setModel(self.model)
        self.windowNew.filemanager.setRootIndex(self.indexRoot)
        self.windowNew.filemanager.clicked.connect(self.on_treeView_clicked)
        self.windowNew.filemanager.doubleClicked.connect(
            self.on_treeView_doubleClicked)
        self.windowNew.filemanager.hideColumn(1)
        self.windowNew.filemanager.hideColumn(2)
        self.windowNew.filemanager.hideColumn(3)

        self._file_selection_model = QtCore.QItemSelectionModel(self.model)
        self._file_selection_model.selectionChanged.connect(self.newFun)

        self.windowNew.filemanager.setAnimated(True)
        self.windowNew.filemanager.setIndentation(20)
        self.windowNew.filemanager.setHeaderHidden(True)
        self.windowNew.filemanager.setSortingEnabled(False)
        self.windowNew.filemanager.setDropIndicatorShown(True)
        self.windowNew.filemanager.setRootIsDecorated(True)
        self.windowNew.filemanager.setUniformRowHeights(True)
        self.windowNew.filemanager.setContextMenuPolicy(
            QtCore.Qt.CustomContextMenu)
        self.windowNew.filemanager.customContextMenuRequested.connect(
            self.showCMFileM)

        self.theFolderPath = path
Пример #12
0
    def __init__(self, parent=None):
        """ """
        try:
            QtWidgets.QTableView.__init__(self, parent)
            self._selectionmodel = None

            # Default setup for tables.
            self.setAlternatingRowColors(True)
            self.setHorizontalScrollMode(
                QtWidgets.QAbstractItemView.ScrollPerPixel)
            #self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
            self.setSelectionMode(
                QtWidgets.QAbstractItemView.ContiguousSelection)
            # Default model, data and selection
            self._tablemodel = ToolboxEditableTableModel()
            self.setModel(self._tablemodel)
            self._selectionmodel = QtCore.QItemSelectionModel(self._tablemodel)
            self.setSelectionModel(self._selectionmodel)
            self.resizeColumnsToContents()
        except Exception as e:
            print('DEBUG, Exception: ', str(e))
            raise
Пример #13
0
    def __init__(self):
        self.filepath = ""

        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.model = Model()
        self.listview.setModel(self.model)
        self.selection = QtCore.QItemSelectionModel(self.model)
        self.listview.setSelectionModel(self.selection)
        self.delegate = Delegate()
        self.listview.setItemDelegate(self.delegate)
        self.listview.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)

        self.open_action.triggered.connect(self.readFromFile)
        self.save_action.triggered.connect(self.writeToFile)
        self.saveAs_action.triggered.connect(self.writeToFile)
        self.add_button.pressed.connect(self.addElement)
        self.de_button.pressed.connect(self.deleteElement)
        self.change_button.pressed.connect(self.changeElement)

        self.model.dataChanged.connect(self.modelModified)
Пример #14
0
 def __init__(self,app):
   QMainWindow.__init__(self)
   Ui_MainWindow.__init__(self)
   
   PLSDR.VERSION = "2.0"
   
   # device names and invocation strings --
   # some are tested, some are search results
   # of doubtful accuracy.
   # feel free to add new entries.
   # please tell the author of any new, successful
   # devices and invocation strings
   # or problems with (or changes to) these
   # also enter local IP:port values where required
   
   self.device_dict = {
     'AirSpy':'airspy',
     'BladeRF':'bladerf',
     'FCD':'fcd',
     'HackRF':'hackrf',
     'LimeSDR':'soapy=0,driver=lime',
     'Miri':'miri',
     'OsmoSDR':'osmosdr',
     'PlutoSDR':'ip:pluto.local',      
     'RedPitaya':'redpitaya=127.0.0.1:1234', # change this IP:port value
     'RFSPACE':'sdr-iq',
     'RTL-SDR':'rtl',
     'RTL-SDR TCP':'rtl_tcp=127.0.0.1:1234', # change this IP:port value
     'SDRplay':'soapy=0,driver=sdrplay',
     'USRP':'uhd',
   }
     
   self.app = app
   self.setupUi(self)
   self.setWindowTitle("PLSDR Version %s" % PLSDR.VERSION)
   self.app_icon = QtGui.QIcon()
   self.app_icon.addFile('icon/app_icon_16x16.png', QtCore.QSize(16,16))
   self.app_icon.addFile('icon/app_icon_24x24.png', QtCore.QSize(24,24))
   self.app_icon.addFile('icon/app_icon_32x32.png', QtCore.QSize(32,32))
   self.app_icon.addFile('icon/app_icon_48x48.png', QtCore.QSize(48,48))
   self.app_icon.addFile('icon/app_icon_128x128.png', QtCore.QSize(128,128))
   self.app_icon.addFile('icon/app_icon_256x256.png', QtCore.QSize(256,256))
   app.setWindowIcon(self.app_icon)
   app.aboutToQuit.connect(self.app_quit)
   self.graphic_data = None
   self.config = self.get_default_config()
   self.full_rebuild_flag = True
   self.running = False
   self.enabled = False
   self.upconvert_state_control = None
   self.radio = Radio.Radio(self)
   self.meta_style_sheet = """
   QLabel[accessibleName=FreqDigit] {
     color:#00c000;
     font-size:24pt;
     background:black;
     padding:0;
   }
   QLabel[accessibleName=FreqDigitDark] {
     color:#003000;
     font-size:24pt;
     background:black;
     padding:0;
   }
   QLabel[accessibleName=FreqDigit]:hover {
     color:#00ff00;
     background:#404040;
   }
   QLabel[accessibleName=FreqDigitDark]:hover {
     color:#00ff00;
     background:#404040;
   }
   QWidget[objectName=digit_widget] {
     background:black;
   }
   /* this solves the mouse tooltip color problem */
   DisplayPlot {
     qproperty-zoomer_color: #c0e0ff;
   }
   QTextEdit {
     text-align:right;
   }
   """
   self.setStyleSheet(self.meta_style_sheet)
   
   # maps keyboard keys to frequency changes in Hz
   self.key_hash = {
     QtCore.Qt.Key_Minus  : -1e2,
     QtCore.Qt.Key_Plus  : 1e2,
     QtCore.Qt.Key_Left  : -1e3, 
     QtCore.Qt.Key_Right  : 1e3, 
     QtCore.Qt.Key_Up  : -1e4, 
     QtCore.Qt.Key_Down  : 1e4, 
     QtCore.Qt.Key_PageUp  : -1e5, 
     QtCore.Qt.Key_PageDown  : 1e5, 
     QtCore.Qt.Key_Insert  : -1e6, 
     QtCore.Qt.Key_Delete  : 1e6, 
   }
   
   # locate user's home directory, create configuration path
   home_dir = os.path.expanduser('~')
   classname = self.__class__.__name__
   self.config_path = os.path.join(home_dir,".%s" % classname)
   if not os.path.exists(self.config_path):
     os.makedirs(self.config_path)
   self.config_file = os.path.join(self.config_path,'config.ini')
   os.chdir(os.path.dirname(os.path.realpath(__file__)))
   self.run_stop_button.clicked.connect(self.run_stop_event)
   self.quit_button.clicked.connect(self.app_quit)
   
   self.offset_freq_control = None
   
   self.signal_progress_bar.setMinimum(-120)
   self.signal_progress_bar.setMaximum(10)
   
   self.mode_list = ['AM','FM','WFM','USB','LSB','CW_USB','CW_LSB']
     
   self.MODE_AM = 0
   self.MODE_FM = 1
   self.MODE_WFM = 2
   self.MODE_USB = 3
   self.MODE_LSB = 4
   self.MODE_CW_USB = 5
   self.MODE_CW_LSB = 6
   
   self.mode_control = MyCombo.Combo(self,self.config,self.mode_combo,self.change_modes,'mode',self.mode_list)
       
   self.agc_list = ['SW/F','SW/S','HW','OFF']
   
   self.AGC_FAST = 0
   self.AGC_SLOW = 1
   self.AGC_HW = 2
   self.AGC_OFF = 3
   
   self.agc_control = MyCombo.Combo(self,self.config,self.agc_combo,self.set_agc_mode,'agc_mode',self.agc_list)
   
   self.bw_buttonlist = [self.if_bw_wide_button,self.if_bw_medium_button,self.if_bw_narrow_button]
   
   self.BW_WIDE = 0
   self.BW_MEDIUM = 1
   self.BW_NARROW = 2
   
   self.if_bw_buttongroup_control = MyButtonGroup.ButtonGroup(self.config,self.if_bw_button_group,self.set_bw_mode,'bw_mode',self.bw_buttonlist)
   
   self.gain_control_a = MySlider.Slider(self.config,self.gain_slider_a,self.set_named_gain,'gain_a',0,50)
   self.gain_control_b = MySlider.Slider(self.config,self.gain_slider_b,self.set_named_gain,'gain_b',0,50)
   self.gain_control_c = MySlider.Slider(self.config,self.gain_slider_c,self.set_named_gain,'gain_c',0,50)
   self.gain_control_d = MySlider.Slider(self.config,self.gain_slider_d,self.set_named_gain,'gain_d',0,50)
   
   self.af_gain_control = MySlider.Slider(self.config,self.af_gain_slider,self.set_af_gain,'af_gain',0,1,400)
   self.average_control = MySlider.Slider(self.config,self.averaging_slider,self.set_average,'average',1,.01)
   self.squelch_control = MySlider.Slider(self.config,self.squelch_slider,self.set_squelch,'squelch_level',-130,50,400)
   
   self.populate_freq_list()
   model = self.freq_table.model()
   
   selectionModel = QtCore.QItemSelectionModel(model)
   self.freq_table.setSelectionModel(selectionModel)
   selectionModel.selectionChanged.connect(self.row_selected)
   
   self.setup_freq_digits()
   
   self.bandwidth_control = MyCombo.Combo(self,self.config,self.bandwidth_combo,self.set_bandwidth,'bandwidth')
   
   self.fft_sizes = ["%d" % 2**n for n in range(6,20)]
   
   self.fft_size_control = MyCombo.Combo(self,self.config,self.fft_size_combo,self.critical_change,'fft_size',self.fft_sizes)
   self.framerates = ["%d" % n for n in (60,50,30,25,20,15,10,5,2,1)]
   self.framerate_control = MyCombo.Combo(self,self.config,self.framerate_combo,self.critical_change,'framerate',self.framerates)
   
   self.antenna_control = MyCombo.Combo(self,self.config,self.antenna_combo,self.change_antennas,'antenna')
   
   self.sample_rate_control = MyCombo.Combo(self,self.config,self.sample_rate_combo,self.critical_change,'sample_rate')
   
   self.audio_rate_control = MyTextEntry.TextEntry(self,self.audio_rate_text,self.critical_change,'audio_rate',1e3,60e3)
   
   self.cw_base_control = MyTextEntry.TextEntry(self,self.cw_base_text,self.critical_change,'cw_base',1e2,3e3)
   
   self.audio_device_control = MyTextEntry.TextEntry(self,self.audio_device_text,self.critical_change,'audio_device',0,0,True)
   
   self.corr_ppm_control = MyTextEntry.TextEntry(self,self.corr_ppm_text,self.set_corr_ppm,'corr_ppm',-100,100)
   
   self.corr_ppm_upc_control = MyTextEntry.TextEntry(self,self.corr_ppm_upc_text,self.set_corr_ppm_upc,'corr_ppm_upc',-100,100)
   
   self.upconvert_state_control = MyCheckbox.Checkbox(self,self.upconversion_checkbox,self.use_upconversion,'upconvert_state')
   
   self.upconvert_trans_control = MyTextEntry.TextEntry(self,self.upconvert_trans_text,self.update_freq_event,'upconvert_trans',0,50e6)
   
   self.upconvert_freq_control = MyTextEntry.TextEntry(self,self.upconvert_freq_text,self.update_freq_event,'upconvert_freq',0,1000e6)
   
   self.offset_state_control = MyCheckbox.Checkbox(self,self.offset_checkbox,self.use_offset,'offset_state')
   
   self.offset_freq_control = MyTextEntry.TextEntry(self,self.offset_freq_text,self.update_offset_freq,'offset_freq',-10000,10000)
      
   self.dc_offset_control = MyCheckbox.Checkbox(self,self.dc_offset_checkbox,self.set_dc_offset,'dc_offset')
   
   self.iq_balance_control = MyCheckbox.Checkbox(self,self.iq_balance_checkbox,self.set_iq_balance,'iq_balance')
   
   # pause number 1 waits for interface to be rendered
   # before modifying it
   QtCore.QTimer.singleShot(100, self.first_read_config)
Пример #15
0
    def __init__(self, parent=None):
        super(LogfileListWidget, self).__init__(parent)

        # Standard item model
        self.model = LogfileModel(0, 6, self)
        self.selection_model = QtCore.QItemSelectionModel(self.model)

        self.treeview = LogfileListView(self)

        # set ItemModel to treeview widget
        self.treeview.setModel(self.model)
        self.treeview.setSelectionModel(self.selection_model)

        # TreeView setting
        self.treeview.setSelectionMode(
            QtWidgets.QAbstractItemView.ContiguousSelection
        )
        self.selection_model.clear()

        self.file_dialog = None

        # set buttons
        self.label1 = QtWidgets.QLabel(self)
        self.label1.setText("Change all detector to:")
        self.label2 = QtWidgets.QLabel(self)
        self.label2.setText("Change all channel to:")
        self.setall_detector_comboBox = QtWidgets.QComboBox(self)
        self.setall_detector_comboBox.addItem("")
        self.setall_detector_comboBox.setItemText(0, "A")
        self.setall_detector_comboBox.addItem("")
        self.setall_detector_comboBox.setItemText(1, "B")
        self.setall_channel_comboBox = QtWidgets.QComboBox(self)
        self.setall_channel_comboBox.addItem("")
        self.setall_channel_comboBox.setItemText(0, "1")
        self.setall_channel_comboBox.addItem("")
        self.setall_channel_comboBox.setItemText(1, "2")

        self.combobox_layout = QtWidgets.QHBoxLayout()
        self.combobox_layout.addWidget(self.label1)
        self.combobox_layout.addWidget(self.setall_detector_comboBox)
        self.combobox_layout.addWidget(self.label2)
        self.combobox_layout.addWidget(self.setall_channel_comboBox)

        self.open_button = QtWidgets.QPushButton(self)
        self.open_button.setObjectName("Open button")
        self.open_button.setText("Open file")

        self.delete_button = QtWidgets.QPushButton(self)
        self.delete_button.setObjectName("Remove file button")
        self.delete_button.setText("Remove file")

        self.color_button = QtWidgets.QPushButton(self)
        self.color_button.setObjectName("Change plot color")
        self.color_button.setText("Change color")

        self.reset_color_button = QtWidgets.QPushButton(self)
        self.reset_color_button.setObjectName("Reset color to default")
        self.reset_color_button.setText("Reset color")

        self.check_all_button = QtWidgets.QPushButton(self)
        self.check_all_button.setObjectName("Check all button")
        self.check_all_button.setText("Check All")
        self.uncheck_all_button = QtWidgets.QPushButton(self)
        self.uncheck_all_button.setObjectName("Uncheck all button")
        self.uncheck_all_button.setText("Uncheck All")

        self.move_up_button = QtWidgets.QPushButton(self)
        self.move_up_button.setObjectName("Move-up button")
        self.move_up_button.setText("Move up")
        self.move_down_button = QtWidgets.QPushButton(self)
        self.move_down_button.setObjectName("Move-down button")
        self.move_down_button.setText("Move down")

        self.gridLay1 = QtWidgets.QGridLayout()
        self.gridLay1.addWidget(self.open_button, 0, 0, 1, 1)
        self.gridLay1.addWidget(self.delete_button, 0, 1, 1, 1)
        self.gridLay1.addWidget(self.color_button, 0, 2, 1, 1)
        self.gridLay1.addWidget(self.reset_color_button, 0, 3, 1, 1)
        self.gridLay1.addWidget(self.check_all_button, 1, 0, 1, 1)
        self.gridLay1.addWidget(self.uncheck_all_button, 1, 1, 1, 1)
        self.gridLay1.addWidget(self.move_up_button, 1, 2, 1, 1)
        self.gridLay1.addWidget(self.move_down_button, 1, 3, 1, 1)

        self.verLay1 = QtWidgets.QVBoxLayout()
        self.verLay1.addWidget(self.treeview)

        self.verLay2 = QtWidgets.QVBoxLayout(self)
        self.verLay2.addLayout(self.combobox_layout)
        self.verLay2.addLayout(self.verLay1)
        self.verLay2.addLayout(self.gridLay1)

        # signal slot definition
        self.setall_detector_comboBox.activated.connect(
            self.change_all_detector)
        self.setall_channel_comboBox.activated.connect(
            self.change_all_channel)

        # buttons
        self.open_button.clicked.connect(self.open_file)
        self.delete_button.clicked.connect(self.delete_file)
        self.color_button.clicked.connect(self.change_plot_color)
        self.reset_color_button.clicked.connect(self.reset_color)

        self.check_all_button.clicked.connect(
            lambda: self.model.change_all_check_state(2))
        self.uncheck_all_button.clicked.connect(
            lambda: self.model.change_all_check_state(0))
        self.move_up_button.clicked.connect(lambda: self.move_selected(-1))
        self.move_down_button.clicked.connect(lambda: self.move_selected(1))
 def initSelectionModel(self):
     o_selectionModel = QtCore.QItemSelectionModel(self.model(), self)
     self.setSelectionModel(o_selectionModel)
     o_selectionModel.selectionChanged.connect(self.handleSelectionChanged)