コード例 #1
0
ファイル: daemon.py プロジェクト: podcharatee/USBIPManager
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: periphery.py プロジェクト: podcharatee/USBIPManager
    def __init__(self, base, ip_addr):
        super().__init__(base, ip_addr)
        self._loop = get_event_loop()

        self._manager = queue.Manager(self._base)
        self._name = f'SSH connection : {self._ip_addr}'

        self._log = log.Manager(self._base)
        self._lang = lang.SSH
        self._ssh_param = f'{self._ip_addr}:{self._dmn_config.ssh_port}'

        self._connection = SSHClient()
        self._connection.set_missing_host_key_policy(AutoAddPolicy())
コード例 #4
0
    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
コード例 #5
0
ファイル: periphery.py プロジェクト: podcharatee/USBIPManager
    def __init__(self, base, obj, ip_addr):
        super().__init__(base, ip_addr)
        self._obj = obj

        self._loop = get_event_loop()

        self._manager = queue.Manager(self._base)
        self._rchrg_name = f'USB recharge : {self._ip_addr}'
        self._glob_rchrg_name = f'USB global recharge : {self._ip_addr}'

        self._bar = bar.Manager(self._obj.progress)

        self._usb_comp = compatibility.USB(self._base, self._ip_addr)

        self._ssh = SSH(self._base, self._ip_addr)

        self._log = log.Manager(self._base)
        self._lang = lang.USB

        self._rchrg = list()
コード例 #6
0
    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
コード例 #7
0
ファイル: device.py プロジェクト: podcharatee/USBIPManager
    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
コード例 #8
0
    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()