def __init__(self, base): super(LoadDaemonUI, self).__init__(parent=base) uic.loadUi('ui/modal/LoadDaemon.ui', self) self.setAttribute(Qt.WA_DeleteOnClose) self._base = base self._sw_config = ini.SWConfig(self._base) self._dmn_manage = ini.DaemonManage(self._base) self._log = log.Manager(self._base) self._form_req = (self.dmn_addr, self.dmn_port) self._form_ip = (self.dmn_addr, ) for form in self._form_req: form.textEdited.connect(partial(_update_form, form)) self.dmn_port.setText(str(self._sw_config.dmn_def_port)) self.dmn_addr.setValidator(ip_validator) self.dmn_addr.textEdited.connect(partial(_update_form, self.dmn_addr)) self._form_setter = (self.dmn_port, self.dmn_name, self.dmn_filter) self._setter_param = {} for form in self._form_setter: self._setter_param[form] = form.text() self.apply_btn.clicked.connect(self.load_action) self.cancel_btn.clicked.connect(self.close)
def __init__(self, base): super(USBIP, self).__init__() self._base = base self._sw_config = ini.SWConfig(self._base) self._version_type = namedtuple('version_type', 'original barbalion cezanne') self._unix_section = self._version_type('\r\n\r\n', '\r\n\r\n', '\r\n\r\n') self._win_section = self._version_type('\r\n \r\n', '\r\n \r\n', '\r\n\r\n') self._unix_row = self._version_type('\n', '\n', '\n') self._win_row = self._version_type('\r\n', '\r\n', '\r\n') self._unix_pipe = self._version_type('stdout', 'stdout', 'stdout') self._win_pipe = self._version_type('stderr', 'stderr', 'stdout') self._root = path[0] self._unix_path = self._version_type('/sbin/', '/sbin/', '/sbin/') self._win_path = self._version_type( f'{self._root}\\usbip\\original\\bin\\', f'{self._root}\\usbip\\barbalion\\bin\\', f'{self._root}\\usbip\\cezanne\\bin\\') self._unix_seaq = self._version_type('list -r', 'list -r', 'list -r') self._win_seaq = self._version_type('-l', '-l', 'list -r') self._unix_atchq = self._version_type('attach -r {0} -b {1}', 'attach -r {0} -b {1}', 'attach -r {0} -b {1}') self._win_atchq = self._version_type('-a {0} {1}', '-a {0} {1}', 'attach -r {0} -b {1}') self._unix_dtchq = self._version_type('detach -p', 'detach -p', 'detach -p') self._win_dtchq = self._version_type('-d', '-d', 'detach -p') self._section = None self._row = None self._pipe = None self._path = None self._seaq = None self._atchq = None self._dtchq = None # Generate functions for getting compatibility parameters by a template depending on the operating system self._actions = ('_section', '_row', '_pipe', '_path', '_seaq', '_atchq', '_dtchq') for action in self._actions: setattr(self, action, self._get_action(action))
def __init__(self, base, ip_addr): super(UIObj, self).__init__(parent=base) uic.loadUi('ui/widget/daemon.ui', self) self.setAttribute(Qt.WA_DeleteOnClose) self._base = base self._ip_addr = ip_addr self.setObjectName(self._ip_addr) self._is_online = False self._matching = ('Exportable USB devices', '======================', f'- {self._ip_addr}') self._sw_config = ini.SWConfig(self._base) self._manager = queue.Manager(self._base) self._search_name = f'Daemon search : {self._ip_addr}' self._attach_name = f'Daemon attach : {self._ip_addr}' self._detach_name = f'Daemon detach : {self._ip_addr}' self._log = log.Manager(self._base) self._lang = LangDaemon self._ssh = periphery.SSH(self._base, self._ip_addr) self._usb = periphery.USB(self._base, self, self._ip_addr) self.phy_interface = (self._ssh, self._usb) self.usbip_interface = list() self._usbip_comp = compatibility.USBIP(self._base) self._menu_popup = QMenu() for param in _popup_action: _icon = QIcon(f'icon/{param}.png') _lang = getattr(self._lang, f'Popup{param.capitalize()}') setattr(self, f'_action_{param}', QAction(_icon, f'{_lang} {self._ip_addr}', self.frame)) _action = getattr(self, f'_action_{param}') _action.triggered.connect(getattr(self, f'_{param}')) self._menu_popup.addAction(_action) self._menu_phy = QMenu() self._menu_phy.aboutToShow.connect( lambda: self._interface_reload('phy')) self.phy_btn.setMenu(self._menu_phy) self.frame.setContextMenuPolicy(Qt.CustomContextMenu) self.frame.customContextMenuRequested.connect(self._popup_show) self.search_btn.clicked.connect(self.search) self.config_btn.clicked.connect(self.config)
def __init__(self, base): super(SelfSearchUI, self).__init__(parent=base) uic.loadUi('ui/modal/SelfSearch.ui', self) self.setAttribute(Qt.WA_DeleteOnClose) self._base = base self._sw_config = ini.SWConfig(self._base) self._dmn_manage = ini.DaemonManage(self._base) self._bar = bar.Manager(self.bar) self._log = log.Manager(self._base) self._lang = LangSelfSearchUI self._signal = Signal() self._signal.clearSearch_.connect(lambda: self._clearSearch()) self._signal.setSearch_.connect( lambda __ip_addr: self._setSearch(__ip_addr)) self._is_found = False self._manager = queue.Manager(self._base) self._name = 'SelfSearch' self._event = Event() self._form_req = (self.find_ip_ini, self.find_ip_end) for form in self._form_req: form.setText(getattr(self._sw_config, form.objectName())) form.setValidator(ip_validator) form.textEdited.connect(partial(self._update_form, form)) self.search_btn.clicked.connect(self.search_action) self.finish_btn.clicked.connect(self.finish_action) self.load_btn.clicked.connect(self.load_action) self.cancel_btn.clicked.connect(self.close) self._menu_popup = QMenu() for param in _popup_action: _icon = QIcon(f'icon/{param}.png') _lang = getattr(self._lang, f'Popup{param.capitalize()}') _condition = getattr(Qt, f'{param.capitalize()}ed') _action = QAction(_icon, _lang, self) _action.triggered.connect(lambda __bool, __condition=_condition: self._condition(__condition)) self._menu_popup.addAction(_action) self.search.setContextMenuPolicy(Qt.CustomContextMenu) self.search.customContextMenuRequested.connect(self._popup_show)
def __init__(self, base): self._base = base self._loop = get_event_loop() self._sw_config = ini.SWConfig(self._base) self._manager = queue.Manager(self._base) self._proc_name = self.__doc__ self._event = Event() self._event.set() # TODO Log messaging for load/unload action self._log = log.Manager(self._base) self._lang = lang.Performance
def __init__(self, base, ip_addr): self._base = base self._ip_addr = ip_addr self._sw_config = ini.SWConfig(self._base) self._lang = lang.Tree self._signal = Signal() self._signal.addTopLevelItem_.connect( lambda __daemon: self._addTopLevelItem(__daemon)) self._signal.setText_.connect( lambda __bid, __col, __baud: self._setText(__bid, __col, __baud)) self._signal.setToolTip_.connect(lambda __bid, __col, __html: self. _setToolTip(__bid, __col, __html)) self._signal.setIcon_.connect( lambda __bid, __col, __icon: self._setIcon(__bid, __col, __icon))
def __init__(self, base, ip_addr): self._base = base self._ip_addr = ip_addr self._sw_config = ini.SWConfig(self._base) self._dmn_config = ini.Daemon(self._base, self._ip_addr) self._dmn_ui = None self._ssh = periphery.SSH(self._base, self._ip_addr) self._top = device.USBTop(self._base, self._ip_addr) self._interface = { self._ssh: (self._ssh.isOpen, self._ssh.close), self._top: (self._top.isRunning, self._top.cancel) } self._log = log.Manager(self._base) self._lang = LangDaemon
def __init__(self, base): super(SoftwareConfigUI, self).__init__(parent=base) uic.loadUi('ui/modal/SoftwareConfig.ui', self) self.setAttribute(Qt.WA_DeleteOnClose) self._base = base self._interface_manager = InterfaceManager(self) self.config = ini.SWConfig(self._base) self.form_req = (self.lang, self.dmn_def_port, self.clt_ver, self.dev_atch_tmo, self.dev_dtch_tmo, self.queue_tmo, self.dmn_perf, self.dev_perf, self.sys_perf, self.net_perf) self.apply_btn.clicked.connect(self.apply_action) self.cancel_btn.clicked.connect(self.close) self._interface_manager.setup()
def __init__(self, base, obj, ip_addr, usbip_param): super().__init__(base, ip_addr) self._obj = obj self._ip_addr = ip_addr self._usbip_param = usbip_param self._loop = get_event_loop() self._sw_config = ini.SWConfig(self._base) self._manager = queue.Manager(self._base) self._atch_name = f'USBIP attach : {self._ip_addr} : {self.bID()}' self._dtch_name = f'USBIP detach : {self._ip_addr} : {self.bID()}' self._glob_atch_name = f'USBIP global attach : {self._ip_addr}' self._glob_dtch_name = f'USBIP global detach : {self._ip_addr}' self._num_name = f'Extra configuration : {self._ip_addr} : {self.bID()}' self._bar = bar.Manager(self._obj.progress) self._ssh = periphery.SSH(self._base, self._ip_addr) self._system_comp = compatibility.System() self._usbip_comp = compatibility.USBIP(self._base) self._enumeration = Enumerator() self._tree = device.Tree(self._base, self._ip_addr) self._top = device.USBTop(self._base, self._ip_addr) self._dmn_perf = performance.Device(self._base) self._log = log.Manager(self._base) self._lang = lang.USBIP self._is_bound = False self._idx = 1 self._busnum = None self._devnum = None
def __init__(self, base, ip_addr): self._base = base self._ip_addr = ip_addr self._loop = get_event_loop() self._sw_config = ini.SWConfig(self._base) self._manager = queue.Manager(self._base) self._name_running = f'USBTOP processing running : {self._ip_addr}' self._name_cancelling = f'USBTOP processing cancelling : {self._ip_addr}' self._ssh = periphery.SSH(self._base, self._ip_addr) self._log = log.Manager(self._base) self._lang = lang.USBTop self._tree = Tree(self._base, self._ip_addr) self._dmn_perf = performance.Device(self._base) self._thread = Thread() self._event = Event() self._pid = None
def __init__(self): super(USBIPManagerUI, self).__init__() uic.loadUi('ui/USBIPManager.ui', self) self.setWindowIcon(QIcon('icon/logo.png')) self._center() self._sw_config = ini.SWConfig(self) self._dmn_manager = ini.DaemonManage(self) self._manager = queue.Manager(self) self._atch_name = 'USBIP attach all' self._dtch_name = 'USBIP detach all' self._shutdown_name = 'Software shutdown' _repr = config.ProgressRepr(self.progress, self.__class__.__name__) self._bar = bar.Manager(_repr.replace()) self._perf = performance.Manager(self) self._perf.load() self._log = log.Manager(self) self._lang = lang.USBIPManagerUI self.self_search_btn.clicked.connect(self._self_search) self.search_btn.clicked.connect(self._search_all) self.atch_btn.clicked.connect(self._atch_all) self.dtch_btn.clicked.connect(self._dtch_all) self.load_btn.clicked.connect(self._scroll_load) self.queue_btn.clicked.connect(self._queue_manager) self.config_btn.clicked.connect(self._configuration) self.doc_btn.clicked.connect(self._documentation) self._popup_param = ('scroll', 'log') self._scroll_param = ('poweroff', 'load', 'clear') self._log_param = ('clear', ) for action in self._popup_param: setattr(self, f'_popup_{action}', self._popup_action(action)) _popup = getattr(self, f'_popup_{action}') _obj = getattr(self, action) _obj.setContextMenuPolicy(Qt.CustomContextMenu) _obj.customContextMenuRequested.connect(_popup) setattr(self, f'_menu_{action}', QMenu()) _menu = getattr(self, f'_menu_{action}') _action_param = getattr(self, f'_{action}_param') for param in _action_param: _icon = QIcon(f'icon/{param}.png') _lang = getattr( self._lang, f'Popup{action.capitalize()}{param.capitalize()}') setattr(self, f'_action_{action}_{param}', QAction(_icon, _lang, _obj)) _action = getattr(self, f'_action_{action}_{param}') _action.triggered.connect(getattr(self, f'_{action}_{param}')) _menu.addAction(_action) for _daemon in self.__all(): _daemon.load()