Esempio n. 1
0
import inspect
from main import MainWindow
from message_handler import MessageSender
from gui_thread import GuiThread
from message_handler import RxMessage
from event_handler import to_signal
import queue
import time
import os
from setup_emubt import LOG_PATH

#Main window related imports
from objects_with_help import GREEN_BACKGROUND_PUSHBUTTON
from loggers import create_logger

test_logger = create_logger('test_logger', log_path=LOG_PATH)


##### wait_for DECORATOR STUFF #########################################################################################
def __apply_queue_to_method(method, _queue, args, kwargs):
    """
    Wrapps a method so it is output is put into queue.
    """
    def invoke_method():
        _queue.put(method(*args, **kwargs))

    return invoke_method


def __do_until_with_timeout(self, test, _queue, invoke_method, timeout, sleep):
    t0 = time.time()
import struct
import time
import sys

from datetime import datetime
from message_handler.crc import crc_bytes
from random import randrange
from loggers import create_logger
from PyQt4.QtCore import QMutex

from auxiliary_module import Uint16, MeanCalculator
from config import LOG_PATH

log_format = '[%(asctime)s]: %(levelname)s method:"%(funcName)s" %(message)s'
logger_name = "message_handler"
m_logger = create_logger(logger_name, log_path=LOG_PATH, format=log_format)

MAX_PACKET_SIZE = 256 * 8 + 20


class MsgLockTimeout(Exception):
    pass


class RxTimeout(Exception):
    pass


class TxTimeout(Exception):
    pass
Esempio n. 3
0
#!/usr/bin/python
"""
author: Rafal Miecznik
contact: [email protected]
created: 22.03.2020$
"""

import os
from loggers import create_logger

LOG_PATH = os.path.join(os.getcwd(), "REFLASHER_DBG")

if not os.path.isdir(LOG_PATH):
    os.mkdir(LOG_PATH)

# common thread logger
thread_logger = create_logger(name="thread_logger", log_path=LOG_PATH)
Esempio n. 4
0
#
# Created by: PyQt4 UI code generator 4.12.1
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui, Qt
from PyQt4.QtCore import QEvent, pyqtSignal
from objects_with_help import PushButton, HelpTip
import struct
import traceback
from setup_emubt import EMU_BT_PATH, LOG_PATH
from loggers import create_logger
from values_editor import ValuesEditor
from lookup_table import LookupTableEditor

digidiag_logger = create_logger(name="digidiag", log_path=LOG_PATH)

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:

    def _fromUtf8(s):
        return s


try:
    _encoding = QtGui.QApplication.UnicodeUTF8

    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
Esempio n. 5
0
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QFileDialog
from PyQt4.QtCore import pyqtSignal
import os
import configparser
from main_window import ColorProgressBar
from intel_hex_handler import intel_hex_parser
from gui_thread import thread_this_method
from event_handler import EventHandler, to_signal, general_signal_factory
import time
from loggers import create_logger, tstamp
from message_handler import MessageSender, MessageReceiver, RxMessage
import struct

stdout_log = create_logger("stdout")
PACKET_SIZE = 256 * 8

cwd = os.getcwd()
BROWSE_ICON = os.path.join(cwd, 'spec', 'browse.png')
print BROWSE_ICON


class TextBrowserInSubWindow(QtGui.QTextBrowser):
    append_sig = pyqtSignal(object, object)

    def __init__(self):
        QtGui.QTextBrowser.__init__(self)
        self.append_sig.connect(QtGui.QTextBrowser.append)

    def append(self, string):
Esempio n. 6
0
            button_clicked_sig=browse_for_directory,
            title="Something is missing")
except IOError:
    message_box.show_welcome_msg(
        ""
        "Welcome to EMUBT application\n"
        "It looks like a first start\n"
        "Select directory where setup, log and bin files will be stored\n"
        "Start application again when done",
        icon=message_box.Information,
        button_clicked_sig=browse_for_directory,
        title="HELLO WORLD!")

LOG_PATH = os.path.join(EMU_BT_PATH, 'DBG')
BIN_PATH = os.path.join(EMU_BT_PATH, 'DOWNLOADED')

if not os.path.exists(LOG_PATH):
    os.makedirs(LOG_PATH)

if not os.path.exists(BIN_PATH):
    os.makedirs(BIN_PATH)

logger = create_logger("emu_bt", log_path=LOG_PATH, format=log_format)

info = logger.info
debug = logger.debug
error = logger.error
warn = logger.warn

if __name__ == "__main__":
    pass
"""
author: Rafal Miecznik
contact: [email protected]
creation date: 2020-03-20
"""

import time
import serial
from queue import Queue
from threading import Thread, Lock

from config import thread_logger, LOG_PATH
from loggers import create_logger

dbg = thread_logger.debug
rxlog = create_logger("rx_log", log_path=LOG_PATH)


class SerialThread(Thread):
    def __init__(self,
                 target,
                 period=0,
                 delay=0,
                 log_eriod=1,
                 args=(),
                 kwargs={}):
        self.target = target
        self.period = period
        self.delay = delay
        self.args = args
        self.kwargs = kwargs