Exemplo n.º 1
0
    def __init__(self):
        super(Ui, self).__init__()
        uic.loadUi('annotator.ui', self)
        self.setWindowIcon(QtGui.QIcon("pen.svg"))
        self.setAccessibleName("qAnnotator")
        self.setWindowTitle("qAnnotator")

        self.boxes = Boxes(parent=self)

        self.new_label = self.findChild(QtWidgets.QLineEdit, "textEdit")
        self.new_label.returnPressed.connect(self.boxes.add_label)
        self.tweets = {}
        self.tweets_processed = []
        self.read_tweets()
        self.tweets_not_yet_processed = [id for id in self.tweets if id not in self.tweets_processed]
        self.current_tweet = None
        self.labelpredict = LabelPredict([tweet["tweet"] for tweet in self.tweets.values()])
        if len(self.tweets_processed) > 0:
            self.labelpredict.retrain([self.tweets[t] for t in self.tweets_processed])

        self.text = self.findChild(QtWidgets.QTextBrowser, "tweet_text")

        self.progress = self.findChild(QtWidgets.QProgressBar, "progress")
        self.progress.setMaximum(len(self.tweets))
        self.progress.setValue(len(self.tweets_processed))

        self.load_tweet(self.tweets_not_yet_processed.pop(0))

        self.next = self.findChild(QtWidgets.QPushButton, "button_next")
        self.next.clicked.connect(self.next_tweet)
        self.last = self.findChild(QtWidgets.QPushButton, "button_last")
        self.last.clicked.connect(self.last_tweet)

        self.show()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        super().__init__(parent)

        uic.loadUi(resource_path('desktop/ui/main.ui'), self)
        self._settings = QSettings('disco_hue')
        self._manager = None
        self._selected_light = None
        self._bootstrap_ui()
Exemplo n.º 3
0
    def __init__(self, video_source: FrameSource, capture: Capture):
        super(Window, self).__init__()
        loadUi(settings.GUI_FILE_PATH, self)
        with open(settings.STYLE_FILE_PATH, "r") as css:
            self.setStyleSheet(css.read())

        self.startButton.clicked.connect(self.start)
        self.stopButton.clicked.connect(self.stop)
        self.timer = None
        self.video_source = video_source
        self.capture = capture
    def __init__(self):
        super().__init__()
        uic.loadUi('ScheduleGUI.ui', self)
        self.setWindowTitle('import Calendar, print Productivity')
        self.setWindowIcon(QIcon('snakeIcon.ico'))

        global timeVarT
        timeVarT = False
        self.timeYes.clicked.connect(self.timeVar)
        self.submitButton.clicked.connect(self.submit)
        self.anotherYes.clicked.connect(self.anotherEvent)
        self.anotherNo.clicked.connect(self.runIt)
Exemplo n.º 5
0
    def __init__(self, core):
        self.file_name = None

        QMainWindow.__init__(self)
        self.core = core

        #Window code
        self.ui = uic.loadUi('./ui/MainWindow.ui')
        self.setCentralWidget(self.ui)
        #self.changeTitle()
        self.resize(900, 750)

        self.ui.pb_add_player.clicked.connect(
            lambda: self.add_player(self.ui.le_player_name.text()))
        self.ui.le_player_name.returnPressed.connect(
            lambda: self.add_player(self.ui.le_player_name.text()))

        self.ui.lv_players.setContextMenuPolicy(
            Qt.ContextMenuPolicy.CustomContextMenu)
        self.ui.lv_players.customContextMenuRequested.connect(
            self.lv_players_rightclick_menu)

        self.ui.pb_pods.clicked.connect(lambda: self.create_pods())

        self.ui.DEBUG1.clicked.connect(self.update_player_list)
        self.ui.DEBUG1.setText('update_player_list')

        self.ui.DEBUG2.clicked.connect(self.random_results)
        self.ui.DEBUG2.setText('random_results')

        self.ui.DEBUG3.clicked.connect(self.toggle_player_list_sorting)
        self.ui.DEBUG3.setText('toggle_player_list_sorting')
Exemplo n.º 6
0
def print_children_widget(filename: str):
    from PyQt6 import uic

    app = QApplication([])
    ui = uic.loadUi(filename)
    for name, obj in vars(ui).items():
        if isinstance(obj, (QWidget, QAction)):
            print(f"{name}: {type(obj).__name__}")
Exemplo n.º 7
0
    def __init__(self):
        ''' constructor
        '''

        self.app = QtWidgets.QApplication(sys.argv)
        self.mainwindow = uic.loadUi("forms/MainWindow.ui")
        self.init_ui()
        self.connect_signals()

        self.parser = Parser()

        self.root = ""
        self.constants = dict()
        self.frontier_mons = dict()

        pass
Exemplo n.º 8
0
    def show_add_mon_window(self):
        ''' show the (modal) dialog window to add a new mon
        '''

        add_window = uic.loadUi("forms/AddFrontierMon.ui")
        add_window.setModal(True)

        add_window.comboBox_species.setEditable(True)
        add_window.comboBox_species.completer().setCompletionMode(
            QtWidgets.QCompleter.CompletionMode.PopupCompletion)
        add_window.comboBox_species.completer().setFilterMode(
            Qt.MatchFlag.MatchContains)

        add_window.comboBox_species.clear()
        add_window.comboBox_species.addItems(
            self.constants["species"].values())

        add_window.exec()

        # TODO: keep values and insert into master dict

        pass
Exemplo n.º 9
0
            elif child.objectName() == 'dfactor':
                enumerator = DFactor
            else:
                continue
            child.currentIndexChanged.connect(lambda index, c=child: set_arg(c.objectName(), c.itemData(index)))
            for enum in enumerator:
                child.addItem(enum.name, enum.value)


def configure_window(win):
    mode_box = win.modeBox
    display = win.mainGLWidget
    reset = win.resetButton

    mode_box.currentIndexChanged.connect(lambda index: display.set_mode(mode_box.itemData(index)))
    for mode in Mode:
        mode_box.addItem(mode.name, mode.value)
    reset.clicked.connect(lambda: display.clear_vertexes())

    configure_test(display, win, 'scissor')
    configure_test(display, win, 'alpha')
    configure_test(display, win, 'blend')


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = uic.loadUi('main.ui')
    configure_window(window)
    window.show()
    sys.exit(app.exec())
Exemplo n.º 10
0
import sys
from PyQt6 import QtWidgets, uic

app = QtWidgets.QApplication(sys.argv)

window = uic.loadUi("test2.ui")
window.show()
app.exec()
Exemplo n.º 11
0
def template_loader(filename: str, _widget: QWidget) -> None:
    root_dir = os.path.abspath(os.curdir)
    ui = os.path.join(root_dir, filename)
    loadUi(ui, _widget)
Exemplo n.º 12
0
        convertUSDBRL(tela)
    if moedaDe == "USD - DOLAR" and moedaPara == "GBP - LIBRAS":
        convertUSDGBP(tela)

    if moedaDe == "BRL - REAIS" and moedaPara == "AOA - KWANZA":
        convertBRLAOA(tela)
    if moedaDe == "BRL - REAIS" and moedaPara == "EUR - EURO":
        convertBRLEUR(tela)
    if moedaDe == "BRL - REAIS" and moedaPara == "USD - DOLAR":
        convertBRLUSD(tela)
    if moedaDe == "BRL - REAIS" and moedaPara == "GBP - LIBRAS":
        convertBRLGBP(tela)

    if moedaDe == "GBP - LIBRAS" and moedaPara == "AOA - KWANZA":
        convertGBPAOA(tela)
    if moedaDe == "GBP - LIBRAS" and moedaPara == "EUR - EURO":
        convertGBPEUR(tela)
    if moedaDe == "GBP - LIBRAS" and moedaPara == "USD - DOLAR":
        convertGBPUSD(tela)
    if moedaDe == "GBP - LIBRAS" and moedaPara == "BRL - REAIS":
        convertGBPBRL(tela)


app = QtWidgets.QApplication([])
tela = uic.loadUi("gui.ui")

tela.btnConverter.clicked.connect(converter)

tela.show()
app.exec()
Exemplo n.º 13
0
 def __init__(self, *args, **kwargs):
     super(MainWindow, self).__init__(*args, **kwargs)
     uic.loadUi('messenger.ui', self)
     self.pushButton1.clicked.connect(self.pushButton1_clicked)
Exemplo n.º 14
0
 def __init__(self, parent=None):
     super().__init__(parent)
     loadUi("Gui/config.ui", self)
     self.setWindowTitle("hallo")
Exemplo n.º 15
0
 def __init__(self, parent=None):
     super().__init__(parent)
     #self.setupUi("Gui/config.ui")
     loadUi("Gui/config.ui", self)
def main():
    # Variablen
    homePath = os.path.dirname(__file__)  # Ansonsten wird kein Icon angezeigt
    logo_Pfad = os.path.join(homePath, 'Gui\\data\\Icon.png')
    global AppdataPath
    global configfile_pfad
    AppdataPath = os.getenv('APPDATA') + '/Nullpunkt Bscheißer/config'
    AppdataPath = Path(AppdataPath)
    configfile_pfad = Path(str(AppdataPath) + '/config.ini')

    EndPgm = ""

    Planes = []
    InfoTexte = []

    text = []
    EndcodeTXT = []
    lastLineInFile = ""

    NullpunktLBL = [
        " LBL ", " CALL LBL 50", " CYCL DEF 7.0 NULLPUNKT",
        " CYCL DEF 7.1  IX+0", " CYCL DEF 7.2  IY+0", " CYCL DEF 7.3  IZ+0",
        " LBL 0"
    ]
    NullpunktLBL50 = [
        " LBL ", " CYCL DEF 7.0 NULLPUNKT", " CYCL DEF 7.1  X+0",
        " CYCL DEF 7.2  Y+0", " CYCL DEF 7.3  Z+0", " LBL 0"
    ]
    EndcodeTXT = [
        "PLANE RESET STAY\n", "L Z+0 R0 FMAX M92 M9\n", "PLANE RESET TURN",
        "L X+0 Y+0 R0 FMAX M92\n", "STOP M36 M30\n", ";\n"
    ]

    # Funktionen Programmlogic

    def removeNumbers(text):
        for i in range(len(text)):
            textOhneZahl = ""
            platzhalterliste = text[i].split(" ")
            for x in range(len(platzhalterliste) - 1):
                if platzhalterliste[x].isdigit() == True:
                    textOhneZahl = textOhneZahl + " " + platzhalterliste[x + 1]
                else:
                    textOhneZahl = textOhneZahl + " " + platzhalterliste[x + 1]
                text[i] = textOhneZahl
        return text

    def addNumbers(text):
        lines = 0
        jump = 0
        for i in range(len(text)):
            lines = lines + 1
            if "CYCL DEF" in text[i]:
                text[i] = writeNumberVorLine(text[i], lines)

                jump = 0
                stop = 0
                counter = 0
                while stop != 1:
                    counter = counter + 1
                    if "Q" in text[i + counter]:
                        jump = jump + 1
                        stop = 0
                    else:
                        stop = 1
            elif jump != 0:
                jump = jump - 1
                lines = lines - 1
            else:
                text[i] = writeNumberVorLine(text[i], lines)
        return text

    def writeNumberVorLine(tempText, lines):
        if tempText[:1] != " ":
            tempText = str(lines) + " " + tempText
            if lines <= 9:
                tempText = "0" + tempText
        else:
            tempText = str(lines) + tempText
            if lines <= 9:
                tempText = "0" + tempText
        return tempText

    def addLBL(text, Planes, InfoTexte):
        ReadConfigfile()

        for i in range(len(Planes)):
            for x in range(len(text)):
                s = 0
                if str(Planes[i]) == str(text[x - s]):
                    LabelNummer = 50 + i
                    text.insert(x + 1, " CALL LBL " + str(LabelNummer) + "\n")
                    s = s + 1

        for i in range(len(Planes)):
            number = 50 + i
            text.insert(len(text),
                        NullpunktLBL[0] + str(number) + " ; " + Planes[i])

            if cf_SchwenkTexte == "true":
                text.insert(len(text), " ; " + InfoTexte[i])
            if number != 50:
                text.insert(len(text), NullpunktLBL[1] + "\n")
                text.insert(len(text), NullpunktLBL[2] + "\n")
                text.insert(len(text), NullpunktLBL[3] + "\n")
                text.insert(len(text), NullpunktLBL[4] + "\n")
                text.insert(len(text), NullpunktLBL[5] + "\n")
                text.insert(len(text), NullpunktLBL[6] + "\n")
                text.insert(len(text), " ;" + "\n")
            if number == 50:
                text.insert(len(text), NullpunktLBL50[1] + "\n")
                text.insert(len(text), NullpunktLBL50[2] + "\n")
                text.insert(len(text), NullpunktLBL50[3] + "\n")
                text.insert(len(text), NullpunktLBL50[4] + "\n")
                text.insert(len(text), NullpunktLBL50[5] + "\n")
                text.insert(len(text), " ;" + "\n")

        return text

    def findPlanes(text):
        planesVar = []
        infotext = []

        for i in range(len(text)):
            if "END PGM" in text[i]:
                EndPgm = text[i]

            if "PLANE" in text[i]:
                planesVar.insert(len(planesVar), text[i])

                for x in range(5):
                    if "SPATIAL" in text[i]:
                        if "Operation" in text[i + x]:
                            infotext.insert(len(infotext), text[i + x + 1])
                        if "Operation" in text[i - x]:
                            infotext.insert(len(infotext), text[i - x + 1])

        PlanesZwischenspeicher = []
        for i in planesVar:
            if i not in PlanesZwischenspeicher:
                PlanesZwischenspeicher.append(i)
        planesVar = PlanesZwischenspeicher

        PlanesZwischenspeicher = []
        for i in planesVar:
            if "PLANE RESET TURN" in i:
                pass
            elif i not in PlanesZwischenspeicher:
                PlanesZwischenspeicher.append(i)
        planesVar = PlanesZwischenspeicher

        return planesVar, infotext, EndPgm

    def addEND(text):
        stop = 0
        counter = 0
        textBackupTemp = text
        while stop < 1:
            counter = counter + 1
            if counter > 10:
                ErrorWindow.ErrorText.setText(
                    "Die datei kann nicht bearbeitet werden da M30 fehlt \noder die Datei sonstige fehler aufweißt."
                )
                ErrorWindow.show()
                ProgressBar(0)
                return stop
            if "M05" in text[len(text) - 1] or "M5" in text[len(text) - 1]:
                stop = 2
            else:
                text.pop(len(text) - 1)
                stop = 0

        for x in range(len(EndcodeTXT)):
            EndcodeTXT[x] = EndcodeTXT[x].replace('\n', '')

        i = len(text)
        for x in range(len(EndcodeTXT)):
            w = x + i
            text.insert(w, " " + EndcodeTXT[x] + "\n")

        return text

    def DateiSchreiben(DateiPfad, text):
        x = open(DateiPfad, 'w')
        for i in range(len(text)):
            x.writelines(text[i])

    # GUIFunktionen

    def ButtonSelectPath():
        ReadConfigfile()
        filepath = QFileDialog.getOpenFileName(None, 'Test Dialog',
                                               cf_PostOrdner,
                                               'Heidenhain Programm(*.h*)')
        MainWindow.rawFilePath.setText(filepath[0])

    def ButtonOpenEinstellungen():
        EinstellungenWindow.show()

    def ProgressBar(Prozent):
        MainWindow.progressBar.setValue(Prozent)
        if Prozent == 100:
            MainWindow.LabelDone.setVisible(True)
        else:
            MainWindow.LabelDone.setVisible(False)

    def ButtonStartEditFile():
        ReadConfigfile()
        text = []
        del text[:]

        DateiPfad = MainWindow.rawFilePath.text()
        if DateiPfad == "":
            ErrorWindow.ErrorText.setText("Bitte eine Datei selektieren!")
            ErrorWindow.show()
            return
        if ".H" in DateiPfad:
            pass
        elif ".h" in DateiPfad:
            pass
        else:
            ErrorWindow.ErrorText.setText(
                "Bitte gib eine gültige Datei an. Endung = .h oder .H")
            ErrorWindow.show()
            return

        ProgressBar(10)
        Datei = open(DateiPfad, 'r')
        text = Datei.readlines()
        ProgressBar(20)
        Datei.close()

        for i in range(len(text)):
            if "CALL LBL 50" in text[i]:
                ProgressBar(0)
                del text[:]
                ErrorWindow.ErrorText.setText(
                    "Diese datei wurde bereits bearbeitet!!")
                ErrorWindow.show()
                return

        text = removeNumbers(text)
        ProgressBar(30)

        Planes = findPlanes(text)
        InfoTexte = Planes[1]
        InfoTexte.insert(0, "Nullpunkt zurücksetzen \n")
        EndPgm = Planes[2]
        Planes = Planes[0]
        ProgressBar(40)

        if cf_Endcode == "true":
            text = addEND(text)
            if text == 0:
                return
        else:
            stop = 0
            counter = 0
            while stop < 1:
                counter = counter + 1
                if counter > 10:
                    ErrorWindow.ErrorText.setText(
                        "Die datei kann nicht bearbeitet werden da M30 fehlt \noder die Datei sonstige fehler aufweißt."
                    )
                    ErrorWindow.show()
                    ProgressBar(0)
                    return
                if "M30" in text[len(text) -
                                 1] or "CYCL DEF 32.1" in text[len(text) - 1]:
                    stop = 2
                    text.insert(len(text), " ;\n")
                else:
                    text.pop(len(text) - 1)
                    stop = 0
        ProgressBar(50)

        if cf_LblNachM30 == "true":
            text = addLBL(text, Planes, InfoTexte)
        ProgressBar(60)

        text.insert(len(text), EndPgm + "\n")
        ProgressBar(70)

        if cf_withoutNumbers == "true":
            text = addNumbers(text)
        ProgressBar(80)

        DateiSchreiben(DateiPfad, text)
        ProgressBar(100)
        del Planes[:]
        del InfoTexte[:]
        del text[:]

    def ClosseErrorWindow():
        ErrorWindow.close()

    def BackToMainWindow():
        # Code ob sicher nicht speichern
        EinstellungenWindow.close()

    def SaveConfig():
        pass

    def LoadConfig():
        pass

    # Config Funktionen -----------------------

    def SaveEinstllungen(config_file):
        if EinstellungenWindow.EndcodHinzu.isChecked() == False:
            config.set('Einstellungen', 'Endcode', 'false')
        else:
            config.set('Einstellungen', 'Endcode', 'true')

        if EinstellungenWindow.SchwenkTexte.isChecked() == False:
            config.set('Einstellungen', 'SchwenkTexte', 'false')
        else:
            config.set('Einstellungen', 'SchwenkTexte', 'true')

        if EinstellungenWindow.withoutNumbers.isChecked() == False:
            config.set('Einstellungen', 'withoutNumbers', 'false')
        else:
            config.set('Einstellungen', 'withoutNumbers', 'true')

        if EinstellungenWindow.LblNachM30.isChecked() == False:
            config.set('Einstellungen', 'LblNachM30', 'false')
        else:
            config.set('Einstellungen', 'LblNachM30', 'true')

        if EinstellungenWindow.InfotexVorToolCall.isChecked() == False:
            config.set('Einstellungen', 'InfotexVorToolCall', 'false')
        else:
            config.set('Einstellungen', 'InfotexVorToolCall', 'true')

        if EinstellungenWindow.PostOrdner.text() == "":
            EinstellungenWindow.PostOrdner.setText(cf_PostOrdner)
            ErrorWindow.ErrorText.setText("Ausgabepfad darf nicht leer sein!")
            ErrorWindow.show()
            return

        EinstellungenWindow.close()
        config.set('Pfade', 'PostOrdner',
                   EinstellungenWindow.PostOrdner.text())

        saveConfigFile(configfile_pfad)

    def CheckAndChangeEinstellungen():
        ReadConfigfile()
        if cf_Endcode == "false":
            EinstellungenWindow.EndcodHinzu.setChecked(False)
        if cf_SchwenkTexte == "false":
            EinstellungenWindow.SchwenkTexte.setChecked(False)
        if cf_withoutNumbers == "false":
            EinstellungenWindow.withoutNumbers.setChecked(False)
        if cf_LblNachM30 == "false":
            EinstellungenWindow.LblNachM30.setChecked(False)
        if cf_InfotexVorToolCall == "false":
            EinstellungenWindow.InfotexVorToolCall.setChecked(False)
        if cf_PostOrdner == "":
            config.set('Pfade', 'PostOrdner', "C:/")
            ReadConfigfile()
            EinstellungenWindow.PostOrdner.setText(cf_PostOrdner)
        else:
            EinstellungenWindow.PostOrdner.setText(cf_PostOrdner)

    def ReadConfigfile():
        # Initialisieren
        global cf_Endcode
        global cf_SchwenkTexte
        global cf_withoutNumbers
        global cf_LblNachM30
        global cf_InfotexVorToolCall
        global cf_PostOrdner

        #  Zuweißen
        cf_Endcode = config['Einstellungen']['Endcode']
        cf_SchwenkTexte = config['Einstellungen']['SchwenkTexte']
        cf_withoutNumbers = config['Einstellungen']['withoutNumbers']
        cf_LblNachM30 = config['Einstellungen']['LblNachM30']
        cf_InfotexVorToolCall = config['Einstellungen']['InfotexVorToolCall']
        cf_PostOrdner = config['Pfade']['PostOrdner']

    def saveConfigFile(configfile_pfad):
        with open(configfile_pfad, 'w') as configfile:
            config.write(configfile)

    # Abarbeitung Programm ---------------------------
    # zuweißung der fenster
    app = QApplication(sys.argv)
    MainWindow = uic.loadUi("Gui/MainWindow.ui")
    ErrorWindow = uic.loadUi("Gui/Error.ui")
    EinstellungenWindow = uic.loadUi("Gui/EinstellungenWindow.ui")

    # Abfragen zwegs config datei
    if os.path.exists(AppdataPath) != True:
        os.makedirs(AppdataPath)
        shutil.copy('config/config.ini', str(AppdataPath))
    if os.path.exists(configfile_pfad) != True:
        shutil.copy('config/config.ini', str(AppdataPath))

    config = ConfigParser()
    config.read(configfile_pfad)

    # Zuweißung Icons
    MainWindow.setWindowIcon(QIcon(logo_Pfad))
    ErrorWindow.setWindowIcon(QIcon(logo_Pfad))
    EinstellungenWindow.setWindowIcon(QIcon(logo_Pfad))

    # Update nach Config
    CheckAndChangeEinstellungen()

    # MainWindow Funktionen
    MainWindow.LabelDone.setVisible(False)  # Fertig text verstecken
    MainWindow.btn_selectfile.clicked.connect(ButtonSelectPath)  # Dateiauswahl

    MainWindow.btn_ButtonStart.clicked.connect(
        ButtonStartEditFile)  # Start verknüpfung
    MainWindow.btn_Einstellungen.clicked.connect(
        ButtonOpenEinstellungen)  # Einstellungen verknüpfung

    # Error Window Funktionen
    ErrorWindow.ErrorOkButton.clicked.connect(
        ClosseErrorWindow)  # Close Errow window

    # Einstellungen Funktionen
    EinstellungenWindow.btn_backToMain.clicked.connect(
        BackToMainWindow)  # Back to Main Menü
    EinstellungenWindow.btn_SaveEinstllungen.clicked.connect(
        SaveEinstllungen)  # Save and Back to Main menü
    EinstellungenWindow.btn_LoadConfig.clicked.connect(
        LoadConfig)  # Save and Back to Main menü
    EinstellungenWindow.btn_SaveConfig.clicked.connect(
        SaveConfig)  # Save and Back to Main menü

    MainWindow.show()  # main window öffnen
    MainWindow.activateWindow()
    sys.exit(app.exec())  # alles beenden
Exemplo n.º 17
0
 def load_ui(ui_file):
     return uic.loadUi(ui_file)
Exemplo n.º 18
0
 def __init__(self, *args, **kwargs):
     super(MainWindow, self).__init__(*args, **kwargs)
     uic.loadUi('messenger.ui', self)