Esempio n. 1
0
 def __init__(self, parent=None, predefined=None):
     # print 'split'
     super(SplitLabelDialog, self).__init__(parent)
     self.tips = ([''] * len(predefined)) if predefined != None else None
     self.length = len(predefined)
     self.lbl = QLabel()
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     self.buttonBox.setEnabled(False)
     self.printf()
     self.layout = QFormLayout()
     index = 0
     for key, item in predefined.items():
         gb = QGroupBox(engTochi[key])
         lot = QHBoxLayout()
         if not isinstance(item, list):
             item = [item]
         for idx, i in enumerate(item):
             checkbox = QRadioButton(i)
             lot.addWidget(checkbox)
             # connect every radiobutton with the label's string
             # and buttonbox's status
             checkbox.toggled.connect(partial(self.getString, i, index))
         gb.setLayout(lot)
         self.layout.addWidget(gb)
         index += 1
     self.layout.addWidget(self.lbl)
     self.layout.addWidget(bb)
     self.setLayout(self.layout)
Esempio n. 2
0
 def __init__(self, parent=None, predefined=None):
     # print 'split'
     super(SplitLabelDialog, self).__init__(parent)
     self.tips = ([''] * len(predefined)) if predefined!=None else None
     self.length = len(predefined)
     self.lbl = QLabel()
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     self.buttonBox.setEnabled(False)
     self.printf()
     self.layout = QFormLayout()
     index = 0
     for key,item in predefined.items():
         gb = QGroupBox(engTochi[key])
         lot = QHBoxLayout()
         if not isinstance(item, list):
             item = [item]
         for idx,i in enumerate(item):
             checkbox = QRadioButton(i)
             lot.addWidget(checkbox)
             # connect every radiobutton with the label's string
             # and buttonbox's status
             checkbox.toggled.connect(partial(self.getString,i, index))
         gb.setLayout(lot)
         self.layout.addWidget(gb)
         index += 1
     self.layout.addWidget(self.lbl)
     self.layout.addWidget(bb)
     self.setLayout(self.layout)
    def __init__(self, text="Enter object label", parent=None):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)
        self.edit.setFixedWidth(600)
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon("done"))
        bb.button(BB.Cancel).setIcon(newIcon("undo"))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        self.writeTypes = QGroupBox(self)
        # self.writeTypes.setExclusive(True)
        self.hwr = QRadioButton("&Handwritten")
        self.prn = QRadioButton("&Printed")
        self.mix = QRadioButton("&Mixed")

        # self.writeTypes.addButton(hwr)
        # self.writeTypes.addButton(prn)
        # self.writeTypes.addButton(mix)
        # layout.addWidget(self.writeTypes)

        layout.addWidget(self.hwr)
        layout.addWidget(self.prn)
        layout.addWidget(self.mix)
        # vbox.addStretch(100)
        # self.writeTypes.setLayout(vbox)

        self.setLayout(layout)
Esempio n. 4
0
    def __init__(self, text="Enter object label", parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)
        self.listItem = listItem[:]

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                #qDebug(item)
                self.listWidget.addItem(item)
            self.listWidget.itemDoubleClicked.connect(self.listItemClick)
            layout.addWidget(self.listWidget)

            # add a shortcut to choose the first label
            action = partial(newAction, self)
            choose1 = action('@Choose label', self.choose, ' ', None,
                             u'Choose label')
            addActions(self.listWidget, (choose1, ))

        self.setLayout(layout)
Esempio n. 5
0
    def __init__(self, text="Enter object label", parent=None, predefined_classes=[]):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)

        # Martin Kersner, 2015/10/13
        if predefined_classes:
            self.edit.setDisabled(True)
            widget = QWidget(self)
            letter_group = QButtonGroup(widget)
            radio_button = []
            for label, label_idx in zip(predefined_classes, range(len(predefined_classes))):
                radio_button.append(QRadioButton(label))
                radio_button[label_idx].clicked.connect(self.changeClass)
                layout.addWidget(radio_button[label_idx])

        layout.addWidget(bb)
        self.setLayout(layout)
Esempio n. 6
0
 def __init__(self, text="Enter object label", parent=None):
     super(LabelDialog, self).__init__(parent)
     self.edit = QLineEdit()
     self.edit.setText(text)
     self.edit.setValidator(labelValidator())
     self.edit.editingFinished.connect(self.postProcess)
     layout = QVBoxLayout()
     layout.addWidget(self.edit)
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     layout.addWidget(bb)
     self.setLayout(layout)
Esempio n. 7
0
 def __init__(self, text="Enter object label", parent=None):
     super(LabelDialog, self).__init__(parent)
     self.edit = QLineEdit()
     self.edit.setText(text)
     self.edit.setValidator(labelValidator())
     self.edit.editingFinished.connect(self.postProcess)
     layout = QVBoxLayout()
     layout.addWidget(self.edit)
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     layout.addWidget(bb)
     self.setLayout(layout)
Esempio n. 8
0
def get_main_app(argv=[]):
    app = QApplication(argv)
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("app"))
    ex = MainWindow()
    ex.show()
    return app, ex
Esempio n. 9
0
 def __init__(
         self,
         text="Enter object label",
         parent=None,
         listItem=None,
         sub_label_items=None,
         label_fre_dic=None):
     super(LabelDialog, self).__init__(parent)
     self.edit = QLineEdit()
     self.edit.setText(text)
     self.edit.setValidator(labelValidator())
     self.edit.editingFinished.connect(self.postProcess)
     layout = QVBoxLayout()
     self.label_fre_dic = label_fre_dic
     layout.addWidget(self.edit)
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     layout.addWidget(bb)
     if sub_label_items:
         self.sub_labels_dic = sub_label_items
         self.sublistwidget = SubListWidget()
         if self.sub_labels_dic.keys() is not None and len(self.sub_labels_dic.keys()) > 0:
             self.listWidget = QListWidget(self)
         keys = sorted(self.sub_labels_dic.keys())
         for item in keys:
             self.listWidget.addItem(item)
         self.listWidget.itemClicked.connect(self.listItemClicked)
         layout.addWidget(self.listWidget)
     elif listItem:
         sorted_labels = []
         if self.label_fre_dic:
             print label_fre_dic
             sorted_labels = sorted(
                 self.label_fre_dic,
                 key=self.label_fre_dic.get,
                 reverse=True)
         if listItem is not None and len(listItem) > 0:
             self.listWidget = QListWidget(self)
         for item in sorted_labels:
             self.listWidget.addItem(item)
         self.listWidget.itemDoubleClicked.connect(
             self.listItemDoubleClicked)
         layout.addWidget(self.listWidget)
     self.setLayout(layout)
Esempio n. 10
0
 def __init__(self,
              text="Enter object label",
              parent=None,
              listItem=None,
              sub_label_items=None,
              label_fre_dic=None):
     super(LabelDialog, self).__init__(parent)
     self.edit = QLineEdit()
     self.edit.setText(text)
     self.edit.setValidator(labelValidator())
     self.edit.editingFinished.connect(self.postProcess)
     layout = QVBoxLayout()
     self.label_fre_dic = label_fre_dic
     layout.addWidget(self.edit)
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     layout.addWidget(bb)
     if sub_label_items:
         self.sub_labels_dic = sub_label_items
         self.sublistwidget = SubListWidget()
         if self.sub_labels_dic.keys() is not None and len(
                 self.sub_labels_dic.keys()) > 0:
             self.listWidget = QListWidget(self)
         keys = sorted(self.sub_labels_dic.keys())
         for item in keys:
             self.listWidget.addItem(item)
         self.listWidget.itemClicked.connect(self.listItemClicked)
         layout.addWidget(self.listWidget)
     elif listItem:
         sorted_labels = []
         if self.label_fre_dic:
             print label_fre_dic
             sorted_labels = sorted(self.label_fre_dic,
                                    key=self.label_fre_dic.get,
                                    reverse=True)
         if listItem is not None and len(listItem) > 0:
             self.listWidget = QListWidget(self)
         for item in sorted_labels:
             self.listWidget.addItem(item)
         self.listWidget.itemDoubleClicked.connect(
             self.listItemDoubleClicked)
         layout.addWidget(self.listWidget)
     self.setLayout(layout)
Esempio n. 11
0
def get_main_app(argv=[]):
    """
    Standard boilerplate Qt application code.
    Do everything but app.exec_() -- so that we can test the application in one thread
    """
    app = QApplication(argv)
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("app"))
    win = MainWindow(argv[1] if len(argv) == 2 else None)
    win.show()
    return app, win
Esempio n. 12
0
def get_main_app(argv=[]):
    """
    Standard boilerplate Qt application code.
    Do everything but app.exec_() -- so that we can test the application in one thread
    """
    app = QApplication(argv)
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("app"))
    win = MainWindow(argv[1] if len(argv) == 2 else None)
    win.show()
    return app, win
Esempio n. 13
0
 def __init__(self, text="Enter object label", parent=None):
     super(LabelDialog, self).__init__(parent)
     layout = QVBoxLayout()
     self.combo = QComboBox()
     self.combo.setEditable(True)
     self.combo.setAutoCompletion(True)
     self.combo.setValidator(labelValidator())
     self.labelCandidates = []
     for text in open('label_list.txt', 'r').readlines():
         t = text.strip()
         if t != '':
             self.combo.addItem(t)
             self.labelCandidates.append(t)
     layout.addWidget(self.combo)
     self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
     bb.button(BB.Ok).setIcon(newIcon('done'))
     bb.button(BB.Cancel).setIcon(newIcon('undo'))
     bb.accepted.connect(self.validate)
     bb.rejected.connect(self.reject)
     layout.addWidget(bb)
     self.setLayout(layout)
Esempio n. 14
0
 def updateFileMenu(self):
     currFilePath = self.filePath
     def exists(filename):
         return os.path.exists(filename)
     menu = self.menus.recentFiles
     menu.clear()
     files = [f for f in self.recentFiles if f != currFilePath and exists(f)]
     for i, f in enumerate(files):
         icon = newIcon('labels')
         action = QAction(
                 icon, '&%d %s' % (i+1, QFileInfo(f).fileName()), self)
         action.triggered.connect(partial(self.loadRecent, f))
         menu.addAction(action)
Esempio n. 15
0
 def updateFileMenu(self):
     current = self.filename
     def exists(filename):
         return os.path.exists(filename)
     menu = self.menus.recentFiles
     menu.clear()
     files = [f for f in self.recentFiles if f != current and exists(f)]
     for i, f in enumerate(files):
         icon = newIcon('labels')
         action = QAction(
                 icon, '&%d %s' % (i+1, QFileInfo(f).fileName()), self)
         action.triggered.connect(partial(self.loadRecent, f))
         menu.addAction(action)
Esempio n. 16
0
    def __init__(self, text="Enter object label", parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                self.listWidget.addItem(item)
            self.listWidget.itemDoubleClicked.connect(self.listItemClick)
            layout.addWidget(self.listWidget)

        self.setLayout(layout)
Esempio n. 17
0
    def __init__(self, text="Enter object label", parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                self.listWidget.addItem(item)
            self.listWidget.itemDoubleClicked.connect(self.listItemClick)
            layout.addWidget(self.listWidget)

        self.setLayout(layout)
Esempio n. 18
0
    def __init__(self, text="Enter object label", parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)
        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)

        self.desc = QLineEdit()
        #Use the below to support multi-line captions/descriptions
        #Show description textbox invisbily st can be dynamically resized
        #self.desc = QTextEdit()
        #self.desc.setAttribute(103)
        #self.desc.show()
        #self.set_desc_height()
        #self.desc.setValidator(labelValidator())
        #self.desc.textChanged.connect(self.set_desc_height)

        layout = QVBoxLayout()
        layout.addWidget(QLabel('Label:'))
        layout.addWidget(self.edit)
        layout.addWidget(QLabel('Description:'))
        layout.addWidget(self.desc)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                self.listWidget.addItem(item)
            self.listWidget.itemDoubleClicked.connect(self.listItemClick)
            layout.addWidget(self.listWidget)

        self.setLayout(layout)
    def __init__(self, text="Enter object label", parent=None):
        super(LabelTagDialog, self).__init__(parent)
        layout = QVBoxLayout()
        self.buttonBox = bb = BB(BB.Ok, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        #bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        #bb.rejected.connect(self.reject)
        self.lbl = QLabel('BBox')

        # Center align text
        self.lbl.setAlignment(Qt.AlignHCenter)
        layout.addWidget(self.lbl)

        layout.addWidget(bb)

        self.combo = QComboBox()
        self.combo.addItems([u"Polygon", u"BBox"])

        self.connect(self.combo, SIGNAL('activated(QString)'), self.combo_chosen)
        self.connect(self.combo, SIGNAL('currentIndexChanged(QString)'), self.combo_chosen)
        layout.addWidget(self.combo)
        self.setLayout(layout)
Esempio n. 20
0
    def __init__(self, parent=None):
        super(TattooDialog, self).__init__(parent)

        self.setMinimumSize(488, 411)

        # Layouts
        layout = QtGui.QVBoxLayout()
        torplayout = QtGui.QHBoxLayout()

        leftbuttonset = QtGui.QVBoxLayout()
        ttypelayout = QtGui.QVBoxLayout()
        self.colorlayout = QtGui.QVBoxLayout()
        tclasslayout = QtGui.QVBoxLayout()
        tattoolayout = QtGui.QHBoxLayout()

        piercinglayout = QtGui.QHBoxLayout()
        ptypelayout = QtGui.QVBoxLayout()
        ploclayout = QtGui.QVBoxLayout()

        # Group declarations
        self.tattoogroup = QtGui.QGroupBox("Tattoo")
        self.ttypegroup = QtGui.QGroupBox("Type")
        self.colorgroup = QtGui.QGroupBox("Color")
        self.tclassgroup = QtGui.QGroupBox("Class")

        self.piercinggroup = QtGui.QGroupBox("Piercing")
        self.ptypegroup = QtGui.QGroupBox("Type")
        self.plocgroup = QtGui.QGroupBox("Location")

        self.piercinggroup.setCheckable(True)
        self.tattoogroup.setCheckable(True)
        self.piercinggroup.setChecked(False)
        self.tattoogroup.setChecked(False)


        # Tattoo Types
        chemical = QtGui.QRadioButton("Chemical")
        brand = QtGui.QRadioButton("Brand")
        cut = QtGui.QRadioButton("Cut")

        # Connect buttons to methods to set the color property to visible or invisible.
        # This is because only chemical tattoos can have color.
        chemical.toggled.connect(self.chemtoggled)
        brand.toggled.connect(self.brandtoggled)
        cut.toggled.connect(self.cuttoggled)

        self.ttypes = [chemical, brand, cut]
        for type in self.ttypes:
            ttypelayout.addWidget(type)
        self.ttypegroup.setLayout(ttypelayout)

        # Tattoo color
        self.monochrome = QtGui.QRadioButton("Monochrome")
        self.color = QtGui.QRadioButton("Color")
        self.colors = [self.monochrome, self.color]
        for c in self.colors:
            self.colorlayout.addWidget(c)
        self.colorgroup.setLayout(self.colorlayout)

        # leftbuttonset consists of tattoo types and color
        leftbuttonset.addStretch()
        leftbuttonset.addWidget(self.ttypegroup)
        leftbuttonset.addStretch()
        leftbuttonset.addWidget(self.colorgroup)
        leftbuttonset.addStretch()

        #Tattoo class
        # Note: tclasses will contain the actual QtGui buttons after the following loop executes
        self.tclasses = ['Human', 'Animal', 'Plant', 'Flag', 'Object', 'Abstract', 'Symbol', 'Word', 'Other']
        for i in range(len(self.tclasses)):
            button = QtGui.QRadioButton(self.tclasses[i])
            tclasslayout.addWidget(button)
            #Replace the strings in tclasses with the actual button
            self.tclasses[i] = button
        self.tclassgroup.setLayout(tclasslayout)

        tattoolayout.addLayout(leftbuttonset)
        tattoolayout.addWidget(self.tclassgroup)

        self.tattoogroup.setLayout(tattoolayout)
        torplayout.addWidget(self.tattoogroup)

        #Piercings

        # Piering types
        # Note: ptypes will contain the actual QtGui buttons after the following loop executes
        self.ptypes = ['Stud', 'Ring', 'Bar', 'Plug', 'Taper', 'Flesh Tunnel', 'Implant']
        for i in range(len(self.ptypes)):
            button = QtGui.QRadioButton(self.ptypes[i])
            ptypelayout.addWidget(button)
            self.ptypes[i] = button
        self.ptypegroup.setLayout(ptypelayout)

        piercinglayout.addWidget(self.ptypegroup)

        self.plocations = ['Forehead', 'Eyebrow', 'Bridge', 'Anti-eyebrow', 'Nose', 'Septum', 'Medusa', 'Monroe',
                      'Dimple', 'Labret', 'Ear', 'Body', 'Other']
        for i in range(len(self.plocations)):
            button = QtGui.QRadioButton(self.plocations[i])
            ploclayout.addWidget(button)
            self.plocations[i] = button
        self.plocgroup.setLayout(ploclayout)

        piercinglayout.addWidget(self.plocgroup)

        self.piercinggroup.setLayout(piercinglayout)
        torplayout.addStretch()
        torplayout.addSpacing(10)
        torplayout.addWidget(self.piercinggroup)


        # Ok / cancel buttons
        self.buttonbox = QtGui.QDialogButtonBox(BB.Ok | BB.Cancel, QtCore.Qt.Horizontal, self)
        self.buttonbox.button(BB.Ok).setIcon(newIcon('done'))
        self.buttonbox.button(BB.Cancel).setIcon(newIcon('undo'))

        self.buttonbox.accepted.connect(self.validate)
        self.buttonbox.rejected.connect(self.reject)

        #Finalize layout
        layout.addLayout(torplayout)
        layout.addWidget(self.buttonbox)

        self.setWindowTitle("Tattoo & Piercing Information")
        self.setLayout(layout)

        self.selected = []
Esempio n. 21
0

def inverted(color):
    return QColor(*[255 - v for v in color.getRgb()])


def read(filename, default=None):
    try:
        with open(filename, 'rb') as f:
            return f.read()
    except:
        return default

if __name__=="__main__":
    """Standard boilerplate Qt application code."""
    parser = argparse.ArgumentParser()
    parser.add_argument('filename', nargs='?', help='image or label filename')
    parser.add_argument('-O', '--output', help='output label name')
    args = parser.parse_args()

    filename = args.filename
    output = args.output

    app = QApplication(sys.argv)
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("app"))
    win = MainWindow(filename, output)
    win.show()
    win.raise_()
    sys.exit(app.exec_())