Exemplo n.º 1
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "display_"))
        self.installTranslator(translator)

        self.mainWindow = TouchWindow(QCoreApplication.translate("main", "Display"))
        rotation = 0
        try:
          config = open("/etc/default/launcher", "r")
          re_match = re.search("SCREEN_ROTATION=(\d+)", config.readline())
          if re_match:
            rotation = int(re_match.group(1))
          config.close()
        except:
          pass
        self.vbox = QVBoxLayout()
        self.mainWindow.centralWidget.setLayout(self.vbox)
        self.rotate = QComboBox()
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 0"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 90"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 180"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 270"))
        rot_idx = int(rotation / 90)
        if (rot_idx < 4):
          self.rotate.setCurrentIndex(rot_idx)
        self.rotate.activated.connect(self.on_change_orientation)
        self.vbox.addWidget(self.rotate)
        self.calibrate = QPushButton(QCoreApplication.translate("main", "Calibrate\ntouchscreen"))
        self.calibrate.clicked.connect(self.on_calibrate_touchscreen)
        self.vbox.addWidget(self.calibrate)
        self.mainWindow.show()
Exemplo n.º 2
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        self.w = FTGUIBaseWidget()
        self.w.show()

        subprocess.Popen(["sudo", SCRIPT, "start-main"])
Exemplo n.º 3
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "about_"))
        self.installTranslator(translator)

        # create the empty main window
        self.mainWindow = TxtWindow(
            QCoreApplication.translate("FtcGuiApplication", "About"))

        menu = self.mainWindow.addMenu()
        menu_ver = menu.addAction(
            QCoreApplication.translate("FtcGuiApplication", "Versions"))
        menu_ver.triggered.connect(self.show_version)

        menu.addSeparator()

        menu_lic_gpl = menu.addAction(
            QCoreApplication.translate("FtcGuiApplication", "GPL license"))
        menu_lic_gpl.triggered.connect(self.show_license_gpl)
        menu_lic_lgpl = menu.addAction(
            QCoreApplication.translate("FtcGuiApplication", "LGPL license"))
        menu_lic_lgpl.triggered.connect(self.show_license_lgpl)
        menu_lic_mit = menu.addAction(
            QCoreApplication.translate("FtcGuiApplication", "MIT license"))
        menu_lic_mit.triggered.connect(self.show_license_mit)

        self.vbox = QVBoxLayout()

        self.vbox.addStretch()

        # and add some text
        self.txt = QLabel(
            QCoreApplication.translate(
                "FtcGuiApplication", "Firmware for fischertechnik - "
                "community edition"))
        self.txt.setObjectName("smalllabel")
        self.txt.setWordWrap(True)
        self.txt.setAlignment(Qt.AlignCenter)
        self.vbox.addWidget(self.txt)

        self.vbox.addStretch()

        self.c = QLabel(
            QCoreApplication.translate("FtcGuiApplication",
                                       "(c) 2016-2020 the ft:community"))
        self.c.setObjectName("tinylabel")
        self.c.setWordWrap(True)
        self.c.setAlignment(Qt.AlignCenter)
        self.vbox.addWidget(self.c)

        self.vbox.addStretch()
        self.mainWindow.centralWidget.setLayout(self.vbox)

        self.mainWindow.show()
Exemplo n.º 4
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(QLocale.system(), os.path.join(path, "network_"))
        self.installTranslator(translator)

        self.w = NetworkWindow()
        self.w.show() 
Exemplo n.º 5
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(QLocale.system(), os.path.join(path, "network_"))
        self.installTranslator(translator)

        self.w = NetworkWindow()
        self.w.show() 
Exemplo n.º 6
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        self.repos = self.load_repos()
        self.repo = "ftc"  # current repository

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "store_"))
        self.installTranslator(translator)

        # create the empty main window
        self.mainWindow = TouchWindow(
            QCoreApplication.translate("Main", "Store"))

        # TODO: Load list
        self.menu = self.mainWindow.addMenu()
        menu_new = self.menu.addAction(
            QCoreApplication.translate("menu", "New"))
        menu_new.triggered.connect(self.on_menu_new)
        self.menu_del = self.menu.addAction(
            QCoreApplication.translate("menu", "Remove"))
        self.menu_del.setEnabled(False)  # cannot delete default repo
        self.menu_del.triggered.connect(self.on_menu_del)
        self.group = QActionGroup(self.menu)
        self.menu.addSeparator()

        self.menu_ftc = self.menu.addAction(
            QCoreApplication.translate("menu", "ftc"))
        self.menu_ftc.setCheckable(True)
        self.menu_ftc.setActionGroup(self.group)
        self.menu_ftc.setChecked(True)
        self.menu_ftc.setData({"name": "ftc", "url": URL})
        self.menu_ftc.triggered.connect(self.on_menu_select_repo)

        self.repo_menu = {}
        for repo in self.repos:
            menu_repo = self.menu.addAction(repo["name"])
            menu_repo.setCheckable(True)
            menu_repo.setActionGroup(self.group)
            menu_repo.setData(repo)
            menu_repo.triggered.connect(self.on_menu_select_repo)
            self.repo_menu[repo["name"]] = menu_repo

        self.vbox = QVBoxLayout()
        self.vbox.setSpacing(0)
        self.vbox.setContentsMargins(0, 0, 0, 0)

        self.applist = AppListWidget(self.mainWindow)
        self.vbox.addWidget(self.applist)

        self.mainWindow.centralWidget.setLayout(self.vbox)

        self.mainWindow.show()
Exemplo n.º 7
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "store_"))
        self.installTranslator(translator)

        # create the empty main window
        self.mainWindow = TouchWindow(
            QCoreApplication.translate("Main", "Store"))

        self.vbox = QVBoxLayout()

        self.applist = AppListWidget(self.mainWindow)
        self.vbox.addWidget(self.applist)

        self.mainWindow.centralWidget.setLayout(self.vbox)

        self.mainWindow.show()
Exemplo n.º 8
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "display_"))
        self.installTranslator(translator)

        self.mainWindow = TouchWindow(
            QCoreApplication.translate("main", "Display"))
        rotation = 0
        try:
            config = open("/etc/default/launcher", "r")
            re_match = re.search("SCREEN_ROTATION=(\d+)", config.readline())
            if re_match:
                rotation = int(re_match.group(1))
            config.close()
        except:
            pass
        self.vbox = QVBoxLayout()
        self.mainWindow.centralWidget.setLayout(self.vbox)
        self.rotate = QComboBox()
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 0"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 90"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 180"))
        self.rotate.addItem(QCoreApplication.translate("main", "Rotate 270"))
        rot_idx = int(rotation / 90)
        if (rot_idx < 4):
            self.rotate.setCurrentIndex(rot_idx)
        self.rotate.activated.connect(self.on_change_orientation)
        self.vbox.addWidget(self.rotate)
        self.calibrate = QPushButton(
            QCoreApplication.translate("main", "Calibrate\ntouchscreen"))
        self.calibrate.clicked.connect(self.on_calibrate_touchscreen)
        self.vbox.addWidget(self.calibrate)
        self.savecalibration = QPushButton(
            QCoreApplication.translate("main", "Save\ncalibration"))
        self.savecalibration.clicked.connect(
            self.on_unset_reset_calibration_flag)
        self.vbox.addWidget(self.savecalibration)
        self.mainWindow.show()
Exemplo n.º 9
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        locale_str = self.locale_read()
        # nothing found in /etc/locale. Try to work with anything
        # the system can provide
        if not locale_str:
            locale_str = QLocale.system().name()

        self.translation_load(locale_str)

        # create the empty main window
        self.w = LanguageWindow(QCoreApplication.translate("main", "Language"))

        self.vbox = QVBoxLayout()

        self.vbox.addStretch()

        self.icon = QLabel()
        self.icon.setAlignment(Qt.AlignCenter)
        self.icon.setPixmap(QPixmap(os.path.join(appdir, "english.png")))
        self.vbox.addWidget(self.icon)

        self.vbox.addStretch()

        self.lang_w = QComboBox()
        self.lang_w.activated[str].connect(self.set_lang)
        self.vbox.addWidget(self.lang_w)

        self.vbox.addStretch()

        self.update_gui()
        self.select_lang(locale_str)

        self.w.centralWidget.setLayout(self.vbox)

        self.w.closed.connect(self.closed)

        self.w.show()
Exemplo n.º 10
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        locale_str = self.locale_read()
        # nothing found in /etc/locale. Try to work with anything
        # the system can provide
        if not locale_str:
            locale_str = QLocale.system().name()

        self.translation_load(locale_str)

        # create the empty main window
        self.w = LanguageWindow(QCoreApplication.translate("main","Language"))

        self.vbox = QVBoxLayout()

        self.vbox.addStretch()

        self.icon = QLabel()
        self.icon.setAlignment(Qt.AlignCenter)
        self.icon.setPixmap(QPixmap(os.path.join(appdir, "english.png")))
        self.vbox.addWidget(self.icon)

        self.vbox.addStretch()

        self.lang_w = QComboBox()
        self.lang_w.activated[str].connect(self.set_lang)
        self.vbox.addWidget(self.lang_w)
   
        self.vbox.addStretch()

        self.update_gui()
        self.select_lang(locale_str)

        self.w.centralWidget.setLayout(self.vbox)

        self.w.closed.connect(self.closed)

        self.w.show()
Exemplo n.º 11
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "wlan_"))
        self.installTranslator(translator)

        self.mainWindow = WlanWindow(
            self, QCoreApplication.translate("Main", "WLAN"))

        self.vbox = QVBoxLayout()

        self.networks = []
        self.connected_ssid = ""
        self.encr_key = ""

        networks_dup = get_networks(IFACE)
        if networks_dup:
            # remove duplicate ssids
            self.networks = []
            if len(networks_dup) > 1:
                for i in range(len(networks_dup) - 1):
                    has_dup = False
                    for j in range(i + 1, len(networks_dup)):
                        if networks_dup[i]['ssid'] == networks_dup[j]['ssid']:
                            has_dup = True
                    if not has_dup:
                        if networks_dup[i]['ssid'] != "\\x00":
                            self.networks.append(networks_dup[i])

                if networks_dup[-1]['ssid'] != "\\x00":
                    self.networks.append(networks_dup[-1])

            # only one ssid returned: This sure has no duplicate
            elif len(networks_dup) > 0:
                self.networks.append(networks_dup[0])

        self.ssids_w = QComboBox()
        if self.networks:
            for network in self.networks:
                self.ssids_w.addItem(network['ssid'])
        self.ssids_w.activated[str].connect(self.set_default_encryption)
        self.ssids_w.setCurrentIndex(-1)
        self.vbox.addWidget(self.ssids_w)

        self.vbox.addStretch()

        self.vbox.addWidget(
            QLabel(QCoreApplication.translate("Main", "Encryption:")))
        self.encr_w = QComboBox()
        self.encr_w.addItems(encr)
        self.vbox.addWidget(self.encr_w)

        self.vbox.addStretch()

        self.vbox.addWidget(QLabel(QCoreApplication.translate("Main", "Key:")))
        self.key = QLineEdit(self.encr_key)
        self.key.setPlaceholderText(
            QCoreApplication.translate("placeholder", "key"))
        self.key.editingFinished.connect(self.do_edit_done)
        self.vbox.addWidget(self.key)

        # the connect button is by default disabled until
        # the user enters a key
        self.connect = QPushButton(
            QCoreApplication.translate("Main", "Connect"))
        self.connect.clicked.connect(self.do_connect)
        self.connect.setDisabled(True)
        self.vbox.addWidget(self.connect)

        # check if a network is already connected
        self.connected_ssid = get_associated(IFACE)
        if self.connected_ssid != "":
            for i in range(len(self.networks)):
                if self.networks[i]['ssid'] == self.connected_ssid:
                    self.ssids_w.setCurrentIndex(i)

        # update gui depending on selected ssid
        if self.networks and self.ssids_w.currentText() != "":
            self.set_default_encryption(self.ssids_w.currentText())

        self.mainWindow.centralWidget.setLayout(self.vbox)

        # make sure key edit has focus
        self.key.setFocus()
        self.mainWindow.show()
Exemplo n.º 12
0
    def __init__(self, application):
        LauncherPlugin.__init__(self, application)

        translator = QTranslator()
        path = os.path.dirname(os.path.realpath(__file__))
        translator.load(self.locale(), os.path.join(path, "wlan_"))
        self.installTranslator(translator)

        self.mainWindow = WlanWindow(self, QCoreApplication.translate("Main", "WLAN"))

        self.vbox = QVBoxLayout()

        self.networks = []
        self.connected_ssid = ""
        self.encr_key = ""
        
        networks_dup = get_networks(IFACE)
        if networks_dup:
            # remove duplicate ssids
            self.networks = []
            if len(networks_dup) > 1:
                for i in range(len(networks_dup)-1):
                    has_dup = False
                    for j in range(i+1,len(networks_dup)):
                        if networks_dup[i]['ssid'] == networks_dup[j]['ssid']:
                            has_dup = True
                    if not has_dup:
                        if networks_dup[i]['ssid'] != "\\x00":
                            self.networks.append(networks_dup[i])

                if networks_dup[-1]['ssid'] != "\\x00":
                    self.networks.append(networks_dup[-1])

            # only one ssid returned: This sure has no duplicate
            elif len(networks_dup) > 0:
                self.networks.append(networks_dup[0])
        
        self.ssids_w = QComboBox()
        if self.networks:
            for network in self.networks:
                self.ssids_w.addItem(network['ssid'])
        self.ssids_w.activated[str].connect(self.set_default_encryption)
        self.ssids_w.setCurrentIndex(-1)
        self.vbox.addWidget(self.ssids_w)

        self.vbox.addStretch()

        self.vbox.addWidget(QLabel(QCoreApplication.translate("Main", "Encryption:")))
        self.encr_w = QComboBox()
        self.encr_w.addItems(encr)
        self.vbox.addWidget(self.encr_w)

        self.vbox.addStretch()

        self.vbox.addWidget(QLabel(QCoreApplication.translate("Main", "Key:")))
        self.key = QLineEdit(self.encr_key)
        self.key.setPlaceholderText(QCoreApplication.translate("placeholder", "key"))
        self.key.editingFinished.connect(self.do_edit_done)
        self.vbox.addWidget(self.key)

        # the connect button is by default disabled until
        # the user enters a key
        self.connect = QPushButton(QCoreApplication.translate("Main", "Connect"))
        self.connect.clicked.connect(self.do_connect)
        self.connect.setDisabled(True)
        self.vbox.addWidget(self.connect)

        # check if a network is already connected
        self.connected_ssid = get_associated(IFACE)
        if self.connected_ssid != "":
            for i in range(len(self.networks)):
                if self.networks[i]['ssid'] == self.connected_ssid:
                    self.ssids_w.setCurrentIndex(i)

        # update gui depending on selected ssid
        if self.networks and self.ssids_w.currentText() != "":
            self.set_default_encryption(self.ssids_w.currentText())

        self.mainWindow.centralWidget.setLayout(self.vbox)

        # make sure key edit has focus
        self.key.setFocus()
        self.mainWindow.show()