コード例 #1
0
 def __init__(self, parent=None):
     super(appbase, self).__init__(parent)
     self.setupUi(self)
     self.recording = False
     self.factory = ApplicationFactory(self)
     self.decDialog = DecoderDialog(self.factory.get_view_actions(), self)
     self._configure_data_view_manager()
     self._setup_connections()
     self.setupWidgets()
     self.populateComPorts()
コード例 #2
0
class Modal(ApplicationFactory(modalview.ModalView).factoryModal):
    '''
    Modal is layout you can use for showing and hide it in temporray ways, modal is
    different than the other layout when you create it in function model you no need
    to adding the into collection
    '''
    pass
コード例 #3
0
ファイル: lister.py プロジェクト: davidraythompson/hsifind
class Lister:

    # path: path of working dir
    def __init__(self, dir, debug=False):
        # dir containing application def/conf files.
        self.dir = dir
        self.appFactory = ApplicationFactory(dir, debug=debug)
        self.debug = debug

    def list(self, format="json"):
        dirList = os.listdir(self.dir)
        dirList.sort()
        #count = 0
        entries = []
        for x in dirList:
            if not x.endswith("."+APP_CONFIG_FILE_SUFFIX):
                continue
            name = x[:-(len(APP_CONFIG_FILE_SUFFIX)+1)]
            app = self.appFactory.get(name, workDirTop="/tmp/p10t/work0", resultUrlTop="file:///tmp/p10t/result0")
            entries.append(app.info())

        if format == "json":
            return entries

        raise ListerException("Unsupported format "+format)
コード例 #4
0
ファイル: mainwindow.py プロジェクト: nevtum/XSeriesTestTool
 def __init__(self, parent = None):
     super(appbase, self).__init__(parent)
     self.setupUi(self)
     self.recording = False
     self.factory = ApplicationFactory(self)
     self.decDialog = DecoderDialog(self.factory.get_view_actions(), self)
     self._configure_data_view_manager()
     self._setup_connections()
     self.setupWidgets()
     self.populateComPorts()
コード例 #5
0
class Grid(ApplicationFactory(gridlayout.GridLayout).factoryLayout):
    '''
    If you prefer to use grid display, use Grid for layout.
    '''
    pass
コード例 #6
0
class Float(ApplicationFactory(floatlayout.FloatLayout).factoryLayout):
    '''
    it's a magic float room, you can use to manage you widget freely without limit.
    '''
    pass
コード例 #7
0
class Box(ApplicationFactory(boxlayout.BoxLayout).factoryLayout):
    '''
    Box is regular layout for application room.
    '''
    pass
コード例 #8
0
class Anchor(ApplicationFactory(anchorlayout.AnchorLayout).factoryLayout):
    '''
    An anchor fixed layout for your application room
    '''
    pass
コード例 #9
0
class Radio(ApplicationFactory(togglebutton.ToggleButton).factoryWidget):
    '''
    Radio, you know what it used for.
    '''
    pass
コード例 #10
0
class Label(ApplicationFactory(label.Label).factoryWidget):
    '''
    If there's any text you want to display then use this Label class.
    '''
    pass
コード例 #11
0
ファイル: lister.py プロジェクト: davidraythompson/hsifind
 def __init__(self, dir, debug=False):
     # dir containing application def/conf files.
     self.dir = dir
     self.appFactory = ApplicationFactory(dir, debug=debug)
     self.debug = debug
コード例 #12
0
class Button(ApplicationFactory(button.Button).factoryWidget):
    '''
    If you want to create a button, or something can be pressed, or touched
    you better use button.
    '''
    pass
コード例 #13
0
class Input(ApplicationFactory(textinput.TextInput).factoryInput):
    '''
    Say if you want to create a input like login input for your application
    you will gonna use this.
    '''
    pass
コード例 #14
0
ファイル: mainwindow.py プロジェクト: nevtum/XSeriesTestTool
class MyApp(appbase, appform):
    def __init__(self, parent = None):
        super(appbase, self).__init__(parent)
        self.setupUi(self)
        self.recording = False
        self.factory = ApplicationFactory(self)
        self.decDialog = DecoderDialog(self.factory.get_view_actions(), self)
        self._configure_data_view_manager()
        self._setup_connections()
        self.setupWidgets()
        self.populateComPorts()
        
    def populateComPorts(self):
        import serial_app
        for port_nr in serial_app.list_serial_ports():
            self.comboBoxComPorts.addItem("COM%i" % port_nr)
    
    def getFactory(self):
        return self.factory

    def setupWidgets(self):
        self.tableView.setColumnWidth(0, 40)
        self.tableView.setColumnWidth(1, 150)
        self.tableView.setColumnWidth(2, 60)
        self.tableView.setColumnWidth(3, 60)
        
        self.tableView2.setColumnWidth(0, 150)

    def _configure_data_view_manager(self):
        self.dvm = self.factory.get_data_view_manager()
        self.dvm.connect_distinct_data(self.tableView)
        self.dvm.connect_session_data(self.tableView2)
        self.dvm.connect_text_inputs(self.lineEdit)
        
        self.refreshView()

    def _setup_connections(self):
        view_actions = self.factory.get_view_actions()
        self.connect(view_actions, SIGNAL("NEXT_ENTRY_NAVIGATED"), self.toNext)
        self.connect(view_actions, SIGNAL("PREVIOUS_ENTRY_NAVIGATED"), self.toPrevious)
        self.connect(view_actions, SIGNAL("FIRST_ENTRY_NAVIGATED"), self.toFirst)
        self.connect(view_actions, SIGNAL("FINAL_ENTRY_NAVIGATED"), self.toLast) 
        
        serial_thread = self.factory.get_serial_thread()
        self.connect(view_actions, SIGNAL("RECORDING_STARTED"), serial_thread.on_record_started)
        self.connect(view_actions, SIGNAL("RECORDING_STOPPED"), serial_thread.on_record_stopped)       
        
        self.actionClear_Session_data.triggered.connect(self.dvm.clearDatabase)
        self.actionEnable_Autorefresh.toggled.connect(self.dvm.setAutoRefresh)
        
        self.actionOpenDecoder.triggered.connect(self.decDialog.show)
        self.tableView.doubleClicked.connect(self.decDialog.show)
        self.tableView.selectionModel().currentChanged.connect(self.decDialog.Update)
        
        self.actionRefresh.triggered.connect(self.refreshView)
        self.btnRecordPause.clicked.connect(self.on_btnRecordPause_clicked)
        self.actionEnable_DebugLog.toggled.connect(self._toggle_logging_settings)

    def _toggle_logging_settings(self, enabled):
        if enabled:
            debug.enable_logging()
        else:
            debug.disable_logging()

    def refreshView(self):
        self.dvm.refresh()

    # to control tableView navigation
    def toFirst(self):
        self.tableView.selectRow(0)

    # to control tableView navigation
    def toNext(self):
        row = self.tableView.selectionModel().currentIndex().row()
        self.tableView.selectRow(row+1)

    # to control tableView navigation
    def toPrevious(self):
        row = self.tableView.selectionModel().currentIndex().row()
        self.tableView.selectRow(row-1)

    # to control tableView navigation
    def toLast(self):
        rowcount = self.dvm.getProxyModel().rowCount()
        self.tableView.selectRow(rowcount-1)

    def on_btnRecordPause_clicked(self):
        view_actions = self.factory.get_view_actions()
        if not self.recording:
            self.btnRecordPause.setText("Pause")
            self.comboBoxComPorts.setDisabled(True)
            self.recording = True
            portname = str(self.comboBoxComPorts.currentText())
            view_actions.start_recording(portname)
        else:
            self.btnRecordPause.setText("Record")
            self.comboBoxComPorts.setDisabled(False)
            self.recording = False
            view_actions.stop_recording()
コード例 #15
0
class MyApp(appbase, appform):
    def __init__(self, parent=None):
        super(appbase, self).__init__(parent)
        self.setupUi(self)
        self.recording = False
        self.factory = ApplicationFactory(self)
        self.decDialog = DecoderDialog(self.factory.get_view_actions(), self)
        self._configure_data_view_manager()
        self._setup_connections()
        self.setupWidgets()
        self.populateComPorts()

    def populateComPorts(self):
        import serial_app
        for port_nr in serial_app.list_serial_ports():
            self.comboBoxComPorts.addItem("COM%i" % port_nr)

    def getFactory(self):
        return self.factory

    def setupWidgets(self):
        self.tableView.setColumnWidth(0, 40)
        self.tableView.setColumnWidth(1, 150)
        self.tableView.setColumnWidth(2, 60)
        self.tableView.setColumnWidth(3, 60)

        self.tableView2.setColumnWidth(0, 150)

    def _configure_data_view_manager(self):
        self.dvm = self.factory.get_data_view_manager()
        self.dvm.connect_distinct_data(self.tableView)
        self.dvm.connect_session_data(self.tableView2)
        self.dvm.connect_text_inputs(self.lineEdit)

        self.refreshView()

    def _setup_connections(self):
        view_actions = self.factory.get_view_actions()
        self.connect(view_actions, SIGNAL("NEXT_ENTRY_NAVIGATED"), self.toNext)
        self.connect(view_actions, SIGNAL("PREVIOUS_ENTRY_NAVIGATED"),
                     self.toPrevious)
        self.connect(view_actions, SIGNAL("FIRST_ENTRY_NAVIGATED"),
                     self.toFirst)
        self.connect(view_actions, SIGNAL("FINAL_ENTRY_NAVIGATED"),
                     self.toLast)

        serial_thread = self.factory.get_serial_thread()
        self.connect(view_actions, SIGNAL("RECORDING_STARTED"),
                     serial_thread.on_record_started)
        self.connect(view_actions, SIGNAL("RECORDING_STOPPED"),
                     serial_thread.on_record_stopped)

        self.actionClear_Session_data.triggered.connect(self.dvm.clearDatabase)
        self.actionEnable_Autorefresh.toggled.connect(self.dvm.setAutoRefresh)

        self.actionOpenDecoder.triggered.connect(self.decDialog.show)
        self.tableView.doubleClicked.connect(self.decDialog.show)
        self.tableView.selectionModel().currentChanged.connect(
            self.decDialog.Update)

        self.actionRefresh.triggered.connect(self.refreshView)
        self.btnRecordPause.clicked.connect(self.on_btnRecordPause_clicked)
        self.actionEnable_DebugLog.toggled.connect(
            self._toggle_logging_settings)

    def _toggle_logging_settings(self, enabled):
        if enabled:
            debug.enable_logging()
        else:
            debug.disable_logging()

    def refreshView(self):
        self.dvm.refresh()

    # to control tableView navigation
    def toFirst(self):
        self.tableView.selectRow(0)

    # to control tableView navigation
    def toNext(self):
        row = self.tableView.selectionModel().currentIndex().row()
        self.tableView.selectRow(row + 1)

    # to control tableView navigation
    def toPrevious(self):
        row = self.tableView.selectionModel().currentIndex().row()
        self.tableView.selectRow(row - 1)

    # to control tableView navigation
    def toLast(self):
        rowcount = self.dvm.getProxyModel().rowCount()
        self.tableView.selectRow(rowcount - 1)

    def on_btnRecordPause_clicked(self):
        view_actions = self.factory.get_view_actions()
        if not self.recording:
            self.btnRecordPause.setText("Pause")
            self.comboBoxComPorts.setDisabled(True)
            self.recording = True
            portname = str(self.comboBoxComPorts.currentText())
            view_actions.start_recording(portname)
        else:
            self.btnRecordPause.setText("Record")
            self.comboBoxComPorts.setDisabled(False)
            self.recording = False
            view_actions.stop_recording()
コード例 #16
0
class Popup(ApplicationFactory(popup.Popup).factoryModal):
    '''
    Popup is also modal but it the layout is not like the other layout, it can add only
    one widget or layout inside it.
    '''
    pass
コード例 #17
0
class Image(ApplicationFactory(image.Image).factoryWidget):
    '''
    Adding some image to beautify you application is a nice idea.
    '''
    pass