Пример #1
0
    def __init__(self):
        self.host = config.get_host()
        self.port = config.get_port()
        self.username = config.get_username()
        self.password = config.get_password(self.host, self.port, self.username)
        self.remember = True

        if all((self.host, self.port, self.username, self.password)):
            if connect(self.host, self.port, self.username, self.password):
                sys.exit()

        self.construct()

        if self.host is not None:
            self.host_entry.set_text(self.host)

        if self.port is not None:
            self.port_entry.set_text(str(self.port))

        if self.username is not None:
            self.username_entry.set_text(self.username)

        if self.password is not None:
            self.password_entry.set_text(self.password)

        self.remember_checkbox.set_active(self.remember)
Пример #2
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.setupUi(self)
        self.setWindowIcon(QIcon(os.path.join(ProgramPath.program_path(), "brickv-icon.png")))
        signal.signal(signal.SIGINT, self.exit_brickv)
        signal.signal(signal.SIGTERM, self.exit_brickv)

        self.async_thread = async_start_thread(self)

        self.setWindowTitle("Brick Viewer " + config.BRICKV_VERSION)
        
        self.tree_view_model_labels = ['Name', 'UID', 'FW Version']
        self.tree_view_model = QStandardItemModel()
        self.tree_view.setModel(self.tree_view_model)
        self.set_tree_view_defaults()   

        # Remove dummy tab
        self.tab_widget.removeTab(1)
        self.last_tab = 0

        self.name = '<unknown>'
        self.uid = '<unknown>'
        self.version = (0, 0, 0)

        self.disconnect_times = []

        self.qtcb_enumerate.connect(self.cb_enumerate)
        self.qtcb_connected.connect(self.cb_connected)
        self.qtcb_disconnected.connect(self.cb_disconnected)

        self.ipcon = IPConnection()
        self.ipcon.register_callback(IPConnection.CALLBACK_ENUMERATE,
                                     self.qtcb_enumerate.emit)
        self.ipcon.register_callback(IPConnection.CALLBACK_CONNECTED,
                                     self.qtcb_connected.emit)
        self.ipcon.register_callback(IPConnection.CALLBACK_DISCONNECTED,
                                     self.qtcb_disconnected.emit)

        self.flashing_window = None
        self.advanced_window = None
        self.delayed_refresh_updates_timer = QTimer()
        self.delayed_refresh_updates_timer.timeout.connect(self.delayed_refresh_updates)
        self.delayed_refresh_updates_timer.setInterval(500)
        self.reset_view()
        self.button_advanced.setDisabled(True)

        self.tab_widget.currentChanged.connect(self.tab_changed)
        self.connect.pressed.connect(self.connect_pressed)
        self.button_flashing.pressed.connect(self.flashing_pressed)
        self.button_advanced.pressed.connect(self.advanced_pressed)
        self.plugin_manager = PluginManager()

        self.combo_host.addItem(config.get_host())
        self.combo_host.addItems(config.get_host_history(HOST_HISTORY_SIZE - 1))
        self.spinbox_port.setValue(config.get_port())

        self.last_host = self.combo_host.currentText()
        self.last_port = self.spinbox_port.value()
Пример #3
0
def get_host():
    return config.get_host(PATHS)
Пример #4
0
        return json.dumps(data)
    elif req == 'status':
        act = bottle.request.forms.action
        opt = bottle.request.forms.option
        return request_status(act, opt)

@bottle.post(SYSTEM['url'])
def system_manager():
    bottle.response.headers['Content-type'] = 'application/json'
    req = bottle.request.forms.request
    if req == 'logs':
        act = bottle.request.forms.action
        full_logs = False
        if act == 'full':
            full_logs = True
        return json.dumps({'vlc_log': manager.get_vlc_log(full_logs)})
    elif req == 'vlc':
        act = bottle.request.forms.action
        if act == 'restart':
            manager.restart_vlc()
        return json.dumps({'vlc_log': manager.get_vlc_log()})
    elif req == 'system':
        act = bottle.request.forms.action
        if act == 'quit':
            sys.stderr.close()

if __name__ == '__main__':
    sound = SoundControl()
    manager = ProcessManager()
    bottle.run(host=config.get_host(), port=8081)