Ejemplo n.º 1
0
 def setUp(self) -> None:
     self.app = QtWidgets.QApplication(sys.argv)
     self.terminal_example = terminal.OstrannaTerminal()
     self.terminal_example.file_to_send = \
         r'C:\Users\juice\Downloads\PycharmProjects\OstrannaTerminal\Ostranna_Logo.ico'
     self.terminal_example.text_settings = data_types.TextSettings()
     self.terminal_example.port_settings = data_types.ComSettings()
Ejemplo n.º 2
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.serial_port = QtSerialPort.QSerialPort()
     self.port_settings: data_types.ComSettings = data_types.ComSettings()
     self.text_settings: data_types.TextSettings = data_types.TextSettings()
     self.all_macros: List[data_types.MacroSet] = list()
     self.current_macros: data_types.MacroSet = data_types.MacroSet(
         name="", macros=list())
     self.load_macros()
     self.counter: int = 0
     self.time_shown = False
     self.tail = ""
     self.file_to_send = ""
     self.graph_form = Optional[terminal_graph.MainWindow]
     self.graph = False
     self.start_time = datetime.datetime.now()
     self.settings_form: Optional[settings.Settings] = None
     self.macros_form: Optional[macros.Macros] = None
     self.ascii_form: Optional[ASCII_table.ASCIITable] = None
     self.help_form: Optional[help.Help] = None
     self.var_form: Optional[variables.Variables] = variables.Variables()
     self.var_form.send_signal[str].connect(self.var_signal_send)
     self.current_font = QtGui.QFont("Consolas", 10)
     self.apply_styles()
     self.macros_btns_list = list()
     self.macros_ui()
     self.load_settings()
     self.serial_port_ui()
     self.set_transmitzone_ui()
     self.create_connections()
     self.init_timer_data()
Ejemplo n.º 3
0
def terminal_example():
    terminal_ex = terminal.OstrannaTerminal()
    terminal_ex.text_settings = data_types.TextSettings()
    terminal_ex.port_settings = data_types.ComSettings()
    terminal_ex.CBSTM.setChecked(True)
    terminal_ex.CBNRF.setChecked(False)
    terminal_ex.CBPorts.setCurrentIndex(0)
    terminal_ex.BtnConnect.click()
    yield terminal_ex
    terminal_ex.destroy()
Ejemplo n.º 4
0
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.CBBaudrate.activated.connect(self.baudrate_changed)
        self.BtnReScan.clicked.connect(self.scan_ports)
        self.BtnConnect.clicked.connect(self.connect)
        self.BtnDisconnect.clicked.connect(self.disconnect)
        self.BtnClear.clicked.connect(self.clear_pressed)
        self.BtnClear.setShortcut('Esc')
        self.BtnSend.clicked.connect(self.send_clicked)
        self.BtnSend2.clicked.connect(self.send_clicked)
        self.BtnCounter.clicked.connect(self.clear_counter)
        self.BtnSave.clicked.connect(self.save_to_file)
        self.BtnCreateMacros.clicked.connect(self.macros_pressed)
        self.TxtTransmit.returnPressed.connect(self.send_clicked)
        self.TxtTransmit2.returnPressed.connect(self.send_clicked)
        self.BtnSettings.clicked.connect(self.settings_pressed)
        self.BtnFile.clicked.connect(self.select_file)
        self.BtnSendFile.clicked.connect(self.send_file)
        self.BtnAscii.clicked.connect(self.ascii_show)

        self.serial_port = QtSerialPort.QSerialPort()
        self.serial_port.readyRead.connect(self.read_data)
        self.serial_port.errorOccurred.connect(self.serial_error)
        self.port_settings: data_types.ComSettings = data_types.ComSettings()
        self.text_settings: data_types.TextSettings = data_types.TextSettings()
        self.scan_ports()
        self.all_macros: List[data_types.MacroSet] = list()
        self.current_macros: data_types.MacroSet = data_types.MacroSet(name="", macros=list())
        self.load_macros()
        self.counter: int = 0
        self.file_to_send = ""
        self.start_time = datetime.datetime.now()
        self.settings_form: Optional[settings.Settings] = None
        self.macros_form: Optional[macros.Macros] = None
        self.ascii_form: Optional[ASCII_table.ASCIITable] = None
        self.colors: Dict[str, Tuple[int, int, int]] = \
            {'background-color': (255, 255, 255), 'font-transmit': (50, 250, 00), 'font-receive': (0, 0, 0),
             'bytes-color': (255, 0, 0)}
        self.CBBaudrate.setCurrentText('115200')
        self.current_font = QtGui.QFont("Consolas", 10)
        self.TxtBuffer.setFont(self.current_font)
        self.TxtBuffer.setTextBackgroundColor(QtGui.QColor(*self.colors['background-color']))
        self.TxtBuffer.setTextColor(QtGui.QColor(*self.colors['font-transmit']))

        self.macros_btns_list = [self.BtnMacros1, self.BtnMacros2, self.BtnMacros3, self.BtnMacros4, self.BtnMacros5,
                                 self.BtnMacros6, self.BtnMacros7, self.BtnMacros8, self.BtnMacros9, self.BtnMacros10,
                                 self.BtnMacros11, self.BtnMacros12, self.BtnMacros13, self.BtnMacros14,
                                 self.BtnMacros15, self.BtnMacros16, self.BtnMacros17, self.BtnMacros18,
                                 self.BtnMacros19, self.BtnMacros20]
        for btn in self.macros_btns_list:
            btn.clicked.connect(self.macro_btn_pressed)
        self.CBMacros.currentTextChanged.connect(self.macros_selected)
        self.load_settings()
Ejemplo n.º 5
0
 def tearDown(self):
     self.terminal_example.text_settings = data_types.TextSettings()
     self.terminal_example.port_settings = data_types.ComSettings()
     self.terminal_example.settings_form.save_settings()
     self.terminal_example.colors = {
         'background-color': (255, 255, 255),
         'font-transmit': (50, 250, 00),
         'font-receive': (0, 0, 0),
         'bytes-color': (255, 0, 0)
     }
     self.terminal_example.current_font = QtGui.QFont("Consolas", 10)
     self.terminal_example.destroy()
     self.app.quit()
Ejemplo n.º 6
0
 def testTextSettings(self):
     right_settings = data_types.TextSettings(CRLF=False,
                                              bytecodes=False,
                                              scroll=False,
                                              timestamps=False,
                                              show_sent=False,
                                              decode=1,
                                              crc_poly=1234,
                                              crc_init=1024,
                                              first_transmit="test1",
                                              second_transmit="test2",
                                              clear=False,
                                              first_repeat=True,
                                              second_repeat=True,
                                              first_period=2000,
                                              second_period=3000)
     self.assertEqual(self.terminal_example.text_settings, right_settings)
Ejemplo n.º 7
0
 def setUp(self):
     self.app = QtWidgets.QApplication(sys.argv)
     self.terminal_example = terminal.OstrannaTerminal()
     self.terminal_example.text_settings = data_types.TextSettings()
     self.terminal_example.port_settings = data_types.ComSettings()