예제 #1
0
class Ui_testGlWindow(object):
    def setupUi(self, testGlWindow):
        if not testGlWindow.objectName():
            testGlWindow.setObjectName(u"testGlWindow")
        testGlWindow.resize(952, 847)
        testGlWindow.setAcceptDrops(True)
        icon = QIcon()
        icon.addFile(u":/images/candle_256.png", QSize(), QIcon.Normal,
                     QIcon.Off)
        testGlWindow.setWindowIcon(icon)
        testGlWindow.setStyleSheet(u"")
        self.centralWidget = QWidget(testGlWindow)
        self.centralWidget.setObjectName(u"centralWidget")
        self.horizontalLayout_5 = QHBoxLayout(self.centralWidget)
        self.horizontalLayout_5.setSpacing(9)
        self.horizontalLayout_5.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.horizontalLayout_5.setContentsMargins(9, 9, 5, 9)
        self.grpProgram = QGroupBox(self.centralWidget)
        self.grpProgram.setObjectName(u"grpProgram")
        self.grpProgram.setFlat(False)
        self.verticalLayout_17 = QVBoxLayout(self.grpProgram)
        self.verticalLayout_17.setSpacing(7)
        self.verticalLayout_17.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_17.setObjectName(u"verticalLayout_17")
        self.verticalLayout_17.setContentsMargins(8, 8, 8, 8)
        self.splitter = QSplitter(self.grpProgram)
        self.splitter.setObjectName(u"splitter")
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.setHandleWidth(12)
        self.frame = QWidget(self.splitter)
        self.frame.setObjectName(u"frame")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.frame.sizePolicy().hasHeightForWidth())
        self.frame.setSizePolicy(sizePolicy)
        self.frame.setMinimumSize(QSize(0, 600))
        self.frame.setStyleSheet(u"border: 1px solid gray;")
        self.verticalLayout_8 = QVBoxLayout(self.frame)
        self.verticalLayout_8.setSpacing(6)
        self.verticalLayout_8.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_8.setObjectName(u"verticalLayout_8")
        self.verticalLayout_8.setContentsMargins(1, 1, 1, 1)
        self.splitter.addWidget(self.frame)
        self.layoutWidget = QWidget(self.splitter)
        self.layoutWidget.setObjectName(u"layoutWidget")
        self.verticalLayout_7 = QVBoxLayout(self.layoutWidget)
        self.verticalLayout_7.setSpacing(9)
        self.verticalLayout_7.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_7.setObjectName(u"verticalLayout_7")
        self.verticalLayout_7.setContentsMargins(0, 0, 0, 0)
        self.tblProgram = QTableView(self.layoutWidget)
        self.tblProgram.setObjectName(u"tblProgram")
        font = QFont()
        font.setPointSize(9)
        self.tblProgram.setFont(font)
        self.tblProgram.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tblProgram.setEditTriggers(QAbstractItemView.AnyKeyPressed
                                        | QAbstractItemView.DoubleClicked
                                        | QAbstractItemView.EditKeyPressed
                                        | QAbstractItemView.SelectedClicked)
        self.tblProgram.setSelectionMode(QAbstractItemView.ContiguousSelection)
        self.tblProgram.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tblProgram.setGridStyle(Qt.DashLine)
        self.tblProgram.horizontalHeader().setMinimumSectionSize(50)
        self.tblProgram.horizontalHeader().setHighlightSections(False)
        self.tblProgram.verticalHeader().setVisible(False)

        self.verticalLayout_7.addWidget(self.tblProgram)

        self.splitter.addWidget(self.layoutWidget)

        self.verticalLayout_17.addWidget(self.splitter)

        self.verticalLayout_17.setStretch(0, 1)

        self.horizontalLayout_5.addWidget(self.grpProgram)

        self.horizontalLayout_5.setStretch(0, 100)
        testGlWindow.setCentralWidget(self.centralWidget)
        self.menuBar = QMenuBar(testGlWindow)
        self.menuBar.setObjectName(u"menuBar")
        self.menuBar.setGeometry(QRect(0, 0, 952, 21))
        testGlWindow.setMenuBar(self.menuBar)

        self.retranslateUi(testGlWindow)

        QMetaObject.connectSlotsByName(testGlWindow)

    # setupUi

    def retranslateUi(self, testGlWindow):
        testGlWindow.setWindowTitle(
            QCoreApplication.translate("testGlWindow", u"Candle", None))
        self.grpProgram.setTitle(
            QCoreApplication.translate("testGlWindow", u"G-code program",
                                       None))
예제 #2
0
class KaitaiView(QScrollArea, View):
    def __init__(self, parent, binaryView):
        QScrollArea.__init__(self, parent)

        View.__init__(self)
        View.setBinaryDataNavigable(self, True)
        self.setupView(self)

        # BinaryViewType
        self.binaryView = binaryView

        self.rootSelectionStart = 0
        self.rootSelectionEnd = 1

        self.ioRoot = None
        self.ioCurrent = None

        # top half = treeWidget + structPath
        self.treeWidget = MyQTreeWidget()
        self.treeWidget.setColumnCount(4)
        self.treeWidget.setHeaderLabels(['label', 'value', 'start', 'end'])
        self.treeWidget.itemSelectionChanged.connect(self.onTreeSelect)

        self.structPath = QLineEdit("root")
        self.structPath.setReadOnly(True)

        topHalf = QWidget(self)
        layout = QVBoxLayout()
        layout.addWidget(self.treeWidget)
        layout.addWidget(self.structPath)
        topHalf.setLayout(layout)

        # bottom half = hexWidget
        self.hexWidget = HexEditor(binaryView,
                                   ViewFrame.viewFrameForWidget(self), 0)

        # splitter = top half, bottom half
        self.splitter = QSplitter(self)
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.addWidget(topHalf)
        self.splitter.addWidget(self.hexWidget)

        self.setWidgetResizable(True)
        self.setWidget(self.splitter)

        self.kaitaiParse()

    # parse the file using Kaitai, construct the TreeWidget
    def kaitaiParse(self, ksModuleName=None):
        log.log_debug('kaitaiParse() with len(bv)=%d and bv.file.filename=%s' %
                      (len(self.binaryView), self.binaryView.file.filename))

        if len(self.binaryView) == 0:
            return

        kaitaiIO = kshelpers.KaitaiBinaryViewIO(self.binaryView)
        parsed = kshelpers.parseIo(kaitaiIO, ksModuleName)
        if not parsed:
            return

        # it SEEMS as if parsing is finished at this moment, but some parsing
        # is postponed until attributes are accessed, so we must try/catch here
        tree = None
        if True:
            try:
                tree = kshelpers.buildQtree(parsed)
            except Exception as e:
                log.log_error(
                    'kaitai module %s threw exception, check file type' %
                    ksModuleName)
                tree = None
        else:
            tree = kshelpers.buildQtree(parsed)

        if not tree:
            return

        self.ioRoot = tree.ksobj._io
        self.ioCurrent = tree.ksobj._io

        self.treeWidget.clear()
        self.treeWidget.setSortingEnabled(False)  # temporarily, for efficiency
        # two options with how we create the hierarchy
        if False:
            # treat root as top level "file" container
            tree.setLabel('file')
            tree.setValue(None)
            tree.setStart(0)
            tree.setEnd(0)
            self.treeWidget.insertTopLevelItem(0, tree)
        else:
            # add root's children as top level items
            self.treeWidget.insertTopLevelItems(0, tree.takeChildren())

        # enable sorting
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.sortByColumn(2, Qt.AscendingOrder)

        # TODO: select first item, maybe expand a few things
        self.rootSelectionStart = 0
        self.rootSelectionEnd = 1

        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.queueInitialPresentation = True

    # binja callbacks
    def getData(self):
        return self.binaryView

    def getStart(self):
        result = self.binaryView.start
        #log.log_debug('getStart() returning '+str(result))
        return result

    def getEnd(self):
        result = self.binaryView.end
        #log.log_debug('getEnd() returning '+str(result))
        return result

    def getLength(self):
        result = len(self.binaryView)
        #log.log_debug('getLength() returning '+str(result))
        return result

    def getCurrentOffset(self):
        result = self.rootSelectionStart + int(
            (self.rootSelectionEnd - self.rootSelectionStart) / 2)
        #result = self.rootSelectionStart
        #log.log_debug('getCurrentOffset() returning '+str(result))
        return result

    def getSelectionOffsets(self):
        result = None
        if self.hexWidget:
            result = self.hexWidget.getSelectionOffsets()
        else:
            result = (self.rootSelectionStart, self.rootSelectionStart)
        #log.log_debug('getSelectionOffsets() returning '+str(result))
        return result

    def setCurrentOffset(self, offset):
        #log.log_debug('setCurrentOffset(0x%X)' % offset)
        self.rootSelectionStart = offset
        UIContext.updateStatus(True)

    def getFont(self):
        return binaryninjaui.getMonospaceFont(self)

    def navigate(self, addr):
        self.rootSelectionStart = addr
        self.rootSelectionEnd = addr + 1
        self.hexWidget.setSelectionRange(addr, addr + 1)
        return True

    def navigateToFileOffset(self, offset):
        #log.log_debug('navigateToFileOffset()')
        return False

    def onTreeSelect(self, wtf=None):
        # get KaitaiTreeWidgetItem
        items = self.treeWidget.selectedItems()
        if not items or len(items) < 1:
            return
        item = items[0]

        # build path, inform user
        structPath = item.label
        itemTmp = item
        while itemTmp.parent():
            itemTmp = itemTmp.parent()
            label = itemTmp.label
            if label.startswith('_m_'):
                label = label[3:]
            structPath = label + '.' + structPath
        self.structPath.setText('root.' + structPath)

        #
        (start, end) = (item.start, item.end)
        if start == None or end == None:
            return

        # determine current IO we're in (the Kaitai input/output abstraction)
        _io = None
        # if the tree item is linked to a KaitaiNode, simply read the IO
        if item.ksobj:
            _io = item.ksobj._parent._io
        else:
            # else we're a leaf
            parent = item.parent()
            if parent:
                # a leaf with a parent -> read parent's IO
                _io = parent.ksobj._io
            else:
                # a leaf without a parent -> we must be at root -> use root IO
                _io = self.ioRoot

        # if the selection is in the root view, store the interval so that upon
        # getCurrentOffset() callback, we return the middle and feature map is
        # updated
        if _io == self.ioRoot:
            self.rootSelectionStart = start
            self.rootSelectionEnd = end

        # current kaitai object is on a different io? then swap HexEditor
        if _io != self.ioCurrent:
            # delete old view
            self.hexWidget.hide()
            self.hexWidget.setParent(None)
            self.hexWidget.deleteLater()
            self.hexWidget = None

            # if it's the original file IO, wrap the already-open file binary view
            if _io == self.ioRoot:
                self.hexWidget = HexEditor(self.binaryView,
                                           ViewFrame.viewFrameForWidget(self),
                                           0)
            # otherwise delete old view, create a temporary view
            else:
                # create new view
                length = _io.size()
                _io.seek(0)
                data = _io.read_bytes(length)
                bv = binaryview.BinaryView.new(data)
                self.hexWidget = HexEditor(bv,
                                           ViewFrame.viewFrameForWidget(self),
                                           0)

            self.splitter.addWidget(self.hexWidget)
            self.ioCurrent = _io

        # now position selection in whatever HexEditor is current
        #log.log_debug('selecting to [0x%X, 0x%X)' % (start, end))
        self.hexWidget.setSelectionRange(start, end)

        # set hex group title to reflect current selection
        #self.hexGroup.setTitle('Hex View @ [0x%X, 0x%X)' % (start, end))

    def getStatusBarWidget(self):
        return menu.KaitaiStatusBarWidget(self)
예제 #3
0
class Ui_tfm(object):
    def setupUi(self, tfm):
        if not tfm.objectName():
            tfm.setObjectName(u"tfm")
        tfm.resize(800, 600)
        tfm.setContextMenuPolicy(Qt.NoContextMenu)
        tfm.setLocale(QLocale(QLocale.English, QLocale.UnitedStates))
        self.action_menu = QAction(tfm)
        self.action_menu.setObjectName(u"action_menu")
        self.action_new_dir = QAction(tfm)
        self.action_new_dir.setObjectName(u"action_new_dir")
        self.action_new_file = QAction(tfm)
        self.action_new_file.setObjectName(u"action_new_file")
        self.action_back = QAction(tfm)
        self.action_back.setObjectName(u"action_back")
        self.action_up = QAction(tfm)
        self.action_up.setObjectName(u"action_up")
        self.action_home = QAction(tfm)
        self.action_home.setObjectName(u"action_home")
        self.action_go = QAction(tfm)
        self.action_go.setObjectName(u"action_go")
        self.action_forward = QAction(tfm)
        self.action_forward.setObjectName(u"action_forward")
        self.action_copy = QAction(tfm)
        self.action_copy.setObjectName(u"action_copy")
        self.action_paste = QAction(tfm)
        self.action_paste.setObjectName(u"action_paste")
        self.action_cut = QAction(tfm)
        self.action_cut.setObjectName(u"action_cut")
        self.action_show_hidden = QAction(tfm)
        self.action_show_hidden.setObjectName(u"action_show_hidden")
        self.action_show_hidden.setCheckable(True)
        self.action_delete = QAction(tfm)
        self.action_delete.setObjectName(u"action_delete")
        self.action_rename = QAction(tfm)
        self.action_rename.setObjectName(u"action_rename")
        self.action_add_to_bookmarks = QAction(tfm)
        self.action_add_to_bookmarks.setObjectName(u"action_add_to_bookmarks")
        self.action_remove_bookmark = QAction(tfm)
        self.action_remove_bookmark.setObjectName(u"action_remove_bookmark")
        self.action_copy_path = QAction(tfm)
        self.action_copy_path.setObjectName(u"action_copy_path")
        self.action_extract_here = QAction(tfm)
        self.action_extract_here.setObjectName(u"action_extract_here")
        self.action_mount_iso = QAction(tfm)
        self.action_mount_iso.setObjectName(u"action_mount_iso")
        self.centralwidget = QWidget(tfm)
        self.centralwidget.setObjectName(u"centralwidget")
        self.horizontalLayout = QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.vsplit = QSplitter(self.centralwidget)
        self.vsplit.setObjectName(u"vsplit")
        self.vsplit.setOrientation(Qt.Horizontal)
        self.hsplit = QSplitter(self.vsplit)
        self.hsplit.setObjectName(u"hsplit")
        self.hsplit.setOrientation(Qt.Vertical)
        self.fs_tree = QTreeView(self.hsplit)
        self.fs_tree.setObjectName(u"fs_tree")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.fs_tree.sizePolicy().hasHeightForWidth())
        self.fs_tree.setSizePolicy(sizePolicy)
        self.fs_tree.setTabKeyNavigation(True)
        self.fs_tree.setProperty("showDropIndicator", True)
        self.fs_tree.setDragEnabled(False)
        self.fs_tree.setDragDropMode(QAbstractItemView.DropOnly)
        self.fs_tree.setDefaultDropAction(Qt.MoveAction)
        self.fs_tree.setRootIsDecorated(False)
        self.hsplit.addWidget(self.fs_tree)
        self.fs_tree.header().setVisible(False)
        self.bookmark_view = QListView(self.hsplit)
        self.bookmark_view.setObjectName(u"bookmark_view")
        self.bookmark_view.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.bookmark_view.setEditTriggers(QAbstractItemView.DoubleClicked
                                           | QAbstractItemView.EditKeyPressed
                                           | QAbstractItemView.SelectedClicked)
        self.bookmark_view.setTabKeyNavigation(True)
        self.bookmark_view.setDragDropOverwriteMode(True)
        self.bookmark_view.setDragDropMode(QAbstractItemView.DropOnly)
        self.bookmark_view.setDefaultDropAction(Qt.CopyAction)
        self.bookmark_view.setAlternatingRowColors(True)
        self.hsplit.addWidget(self.bookmark_view)
        self.mounts_view = QListView(self.hsplit)
        self.mounts_view.setObjectName(u"mounts_view")
        self.mounts_view.setTabKeyNavigation(True)
        self.mounts_view.setAlternatingRowColors(True)
        self.hsplit.addWidget(self.mounts_view)
        self.vsplit.addWidget(self.hsplit)
        self.table_view = QTableView(self.vsplit)
        self.table_view.setObjectName(u"table_view")
        sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy1.setHorizontalStretch(1)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.table_view.sizePolicy().hasHeightForWidth())
        self.table_view.setSizePolicy(sizePolicy1)
        self.table_view.viewport().setProperty("cursor",
                                               QCursor(Qt.ArrowCursor))
        self.table_view.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.table_view.setAcceptDrops(True)
        self.table_view.setToolTipDuration(-3)
        self.table_view.setEditTriggers(QAbstractItemView.AnyKeyPressed
                                        | QAbstractItemView.EditKeyPressed
                                        | QAbstractItemView.SelectedClicked)
        self.table_view.setDragEnabled(True)
        self.table_view.setDragDropMode(QAbstractItemView.DragDrop)
        self.table_view.setDefaultDropAction(Qt.MoveAction)
        self.table_view.setAlternatingRowColors(True)
        self.table_view.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.table_view.setTextElideMode(Qt.ElideMiddle)
        self.table_view.setShowGrid(False)
        self.table_view.setSortingEnabled(True)
        self.table_view.setWordWrap(False)
        self.vsplit.addWidget(self.table_view)
        self.table_view.horizontalHeader().setDefaultSectionSize(150)
        self.table_view.horizontalHeader().setHighlightSections(False)
        self.table_view.horizontalHeader().setStretchLastSection(True)
        self.table_view.verticalHeader().setVisible(False)

        self.horizontalLayout.addWidget(self.vsplit)

        tfm.setCentralWidget(self.centralwidget)
        self.statusbar = QStatusBar(tfm)
        self.statusbar.setObjectName(u"statusbar")
        self.statusbar.setContextMenuPolicy(Qt.NoContextMenu)
        self.statusbar.setSizeGripEnabled(False)
        tfm.setStatusBar(self.statusbar)
        self.toolbar = QToolBar(tfm)
        self.toolbar.setObjectName(u"toolbar")
        self.toolbar.setContextMenuPolicy(Qt.PreventContextMenu)
        self.toolbar.setMovable(False)
        tfm.addToolBar(Qt.TopToolBarArea, self.toolbar)

        self.toolbar.addAction(self.action_back)
        self.toolbar.addAction(self.action_forward)
        self.toolbar.addAction(self.action_up)
        self.toolbar.addAction(self.action_home)
        self.toolbar.addAction(self.action_go)

        self.retranslateUi(tfm)

        QMetaObject.connectSlotsByName(tfm)

    # setupUi

    def retranslateUi(self, tfm):
        tfm.setWindowTitle(QCoreApplication.translate("tfm", u"tfm", None))
        self.action_menu.setText(
            QCoreApplication.translate("tfm", u"Menu", None))
        self.action_new_dir.setText(
            QCoreApplication.translate("tfm", u"New Directory", None))
        self.action_new_file.setText(
            QCoreApplication.translate("tfm", u"New File", None))
        self.action_back.setText(
            QCoreApplication.translate("tfm", u"Back", None))
        self.action_up.setText(QCoreApplication.translate("tfm", u"Up", None))
        self.action_home.setText(
            QCoreApplication.translate("tfm", u"Home", None))
        self.action_go.setText(QCoreApplication.translate("tfm", u"Go", None))
        #if QT_CONFIG(tooltip)
        self.action_go.setToolTip(
            QCoreApplication.translate("tfm", u"Go or Reload", None))
        #endif // QT_CONFIG(tooltip)
        self.action_forward.setText(
            QCoreApplication.translate("tfm", u"Forward", None))
        self.action_copy.setText(
            QCoreApplication.translate("tfm", u"Copy", None))
        self.action_paste.setText(
            QCoreApplication.translate("tfm", u"Paste", None))
        self.action_cut.setText(QCoreApplication.translate(
            "tfm", u"Cut", None))
        self.action_show_hidden.setText(
            QCoreApplication.translate("tfm", u"Show hidden files", None))
        #if QT_CONFIG(shortcut)
        self.action_show_hidden.setShortcut(
            QCoreApplication.translate("tfm", u"Ctrl+H", None))
        #endif // QT_CONFIG(shortcut)
        self.action_delete.setText(
            QCoreApplication.translate("tfm", u"Delete", None))
        self.action_rename.setText(
            QCoreApplication.translate("tfm", u"Rename", None))
        self.action_add_to_bookmarks.setText(
            QCoreApplication.translate("tfm", u"Add to bookmarks", None))
        self.action_remove_bookmark.setText(
            QCoreApplication.translate("tfm", u"Remove bookmark", None))
        #if QT_CONFIG(tooltip)
        self.action_remove_bookmark.setToolTip(
            QCoreApplication.translate("tfm", u"Remove bookmark", None))
        #endif // QT_CONFIG(tooltip)
        self.action_copy_path.setText(
            QCoreApplication.translate("tfm", u"Copy path", None))
        self.action_extract_here.setText(
            QCoreApplication.translate("tfm", u"Extract here", None))
        #if QT_CONFIG(tooltip)
        self.action_extract_here.setToolTip(
            QCoreApplication.translate("tfm", u"Extract here", None))
        #endif // QT_CONFIG(tooltip)
        self.action_mount_iso.setText(
            QCoreApplication.translate("tfm", u"Mount ISO", None))
        #if QT_CONFIG(tooltip)
        self.action_mount_iso.setToolTip(
            QCoreApplication.translate("tfm", u"Mount ISO", None))
예제 #4
0
class BuilderWidget(QWidget):
    def __init__(self, parent=None) -> None:
        super().__init__(parent)

        self.verticalLayout = QVBoxLayout(self)

        self.compileButton = QPushButton('Compile', self)
        self.compileButton.setMinimumSize(QSize(200, 50))
        self.verticalLayout.addWidget(self.compileButton, 0, Qt.AlignHCenter)

        self.tidyButton = QPushButton('Tidy', self)
        self.verticalLayout.addWidget(self.tidyButton, 0, Qt.AlignHCenter)

        self.splitter = QSplitter(self)
        self.splitter.setOrientation(Qt.Vertical)

        self.widget = QWidget(self.splitter)
        self.widget.setObjectName(u"widget")
        self.verticalLayout2 = QVBoxLayout(self.widget)
        self.stdoutLabel = QLabel(self.widget)
        self.stdoutLabel.setText('stdout:')

        self.verticalLayout2.addWidget(self.stdoutLabel)

        self.stdoutText = QTextEdit(self.widget)
        self.stdoutText.setEnabled(False)
        self.stdoutText.setReadOnly(True)
        self.stdoutText.setPlainText("Output will appear here")

        self.verticalLayout2.addWidget(self.stdoutText)

        self.splitter.addWidget(self.widget)

        self.widget1 = QWidget(self.splitter)

        self.verticalLayout3 = QVBoxLayout(self.widget1)
        self.stderrLabel = QLabel(self.widget1)
        self.stderrLabel.setText('stderr:')

        self.verticalLayout3.addWidget(self.stderrLabel)

        self.stderrText = QTextEdit(self.widget1)
        self.stderrText.setEnabled(False)
        self.stderrText.setReadOnly(True)
        self.stderrText.setPlainText('Errors will appear here')

        self.verticalLayout3.addWidget(self.stderrText)

        self.splitter.addWidget(self.widget1)

        self.verticalLayout.addWidget(self.splitter)

        # Logic

        # Use QProcess to start a program and get its outputs https://stackoverflow.com/a/22110924
        self.process = QProcess(self)

        self.process.readyReadStandardOutput.connect(self.readStdout)
        self.process.readyReadStandardError.connect(self.readStderr)
        self.process.started.connect(self.processStarted)
        self.process.finished.connect(self.processFinished)
        self.process.errorOccurred.connect(self.errorOccurred)
        self.compileButton.clicked.connect(self.doCompile)
        self.tidyButton.clicked.connect(self.doTidy)

    def doCompile(self):
        self.cleanupUI()
        self.process.setWorkingDirectory(settings.get_repo_location())
        self.process.startCommand(settings.get_build_command())

    def doTidy(self):
        self.cleanupUI()
        self.process.setWorkingDirectory(settings.get_repo_location())
        self.process.startCommand(settings.get_tidy_command())

    def cleanupUI(self):
        self.stdoutText.setEnabled(True)
        self.stderrText.setEnabled(True)
        self.stdoutText.setPlainText('')
        self.stderrText.setPlainText('')

    def readStdout(self):
        lines = self.process.readAllStandardOutput().data().decode(
        )[:-1].split('\n')
        for line in lines:
            if line == 'tmc.gba: FAILED':
                line = 'tmc.gba: <b style="color:red">FAILED</b>'
            elif line == 'tmc.gba: OK':
                line = 'tmc.gba: <b style="color:lime">OK</b>'
            self.stdoutText.append(line)

    def readStderr(self):
        lines = self.process.readAllStandardError().data().decode()[:-1].split(
            '\n')
        for line in lines:
            if 'error' in line.lower():
                line = f'<span style="color:red">{line}</span>'
            elif 'warning' in line.lower():
                line = f'<span style="color:orange">{line}</span>'

            self.stderrText.append(line)

    def processStarted(self):
        self.compileButton.setEnabled(False)
        self.tidyButton.setEnabled(False)

    def processFinished(self):
        self.compileButton.setEnabled(True)
        self.tidyButton.setEnabled(True)

    def errorOccurred(self):
        self.stderrText.insertPlainText(self.process.errorString())
예제 #5
0
파일: ui_asset_dlg.py 프로젝트: flmnvd/jal
class Ui_AssetDialog(object):
    def setupUi(self, AssetDialog):
        if not AssetDialog.objectName():
            AssetDialog.setObjectName(u"AssetDialog")
        AssetDialog.setWindowModality(Qt.ApplicationModal)
        AssetDialog.resize(927, 323)
        AssetDialog.setModal(False)
        self.gridLayout = QGridLayout(AssetDialog)
        self.gridLayout.setSpacing(2)
        self.gridLayout.setObjectName(u"gridLayout")
        self.gridLayout.setContentsMargins(2, 2, 2, 2)
        self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.gridLayout.addItem(self.horizontalSpacer_4, 1, 2, 1, 1)

        self.frame = QFrame(AssetDialog)
        self.frame.setObjectName(u"frame")
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth())
        self.frame.setSizePolicy(sizePolicy)
        self.frame.setFrameShape(QFrame.NoFrame)
        self.frame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_3 = QHBoxLayout(self.frame)
        self.horizontalLayout_3.setSpacing(2)
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
        self.splitter = QSplitter(self.frame)
        self.splitter.setObjectName(u"splitter")
        sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth())
        self.splitter.setSizePolicy(sizePolicy1)
        self.splitter.setOrientation(Qt.Horizontal)
        self.SymbolsFrame = QFrame(self.splitter)
        self.SymbolsFrame.setObjectName(u"SymbolsFrame")
        sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy2.setHorizontalStretch(5)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(self.SymbolsFrame.sizePolicy().hasHeightForWidth())
        self.SymbolsFrame.setSizePolicy(sizePolicy2)
        self.SymbolsFrame.setFrameShape(QFrame.NoFrame)
        self.SymbolsFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout = QVBoxLayout(self.SymbolsFrame)
        self.verticalLayout.setSpacing(2)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.SymbolsCaptionFrame = QFrame(self.SymbolsFrame)
        self.SymbolsCaptionFrame.setObjectName(u"SymbolsCaptionFrame")
        self.SymbolsCaptionFrame.setFrameShape(QFrame.NoFrame)
        self.SymbolsCaptionFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_5 = QHBoxLayout(self.SymbolsCaptionFrame)
        self.horizontalLayout_5.setSpacing(2)
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.SymbolsLabel = QLabel(self.SymbolsCaptionFrame)
        self.SymbolsLabel.setObjectName(u"SymbolsLabel")

        self.horizontalLayout_5.addWidget(self.SymbolsLabel)

        self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.horizontalLayout_5.addItem(self.horizontalSpacer_2)

        self.AddSymbolButton = QPushButton(self.SymbolsCaptionFrame)
        self.AddSymbolButton.setObjectName(u"AddSymbolButton")

        self.horizontalLayout_5.addWidget(self.AddSymbolButton)

        self.RemoveSymbolButton = QPushButton(self.SymbolsCaptionFrame)
        self.RemoveSymbolButton.setObjectName(u"RemoveSymbolButton")

        self.horizontalLayout_5.addWidget(self.RemoveSymbolButton)


        self.verticalLayout.addWidget(self.SymbolsCaptionFrame)

        self.SymbolsTable = QTableView(self.SymbolsFrame)
        self.SymbolsTable.setObjectName(u"SymbolsTable")
        self.SymbolsTable.setEditTriggers(QAbstractItemView.AnyKeyPressed|QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked)
        self.SymbolsTable.setAlternatingRowColors(True)
        self.SymbolsTable.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.SymbolsTable.verticalHeader().setVisible(False)
        self.SymbolsTable.verticalHeader().setMinimumSectionSize(20)
        self.SymbolsTable.verticalHeader().setDefaultSectionSize(20)

        self.verticalLayout.addWidget(self.SymbolsTable)

        self.splitter.addWidget(self.SymbolsFrame)
        self.DataFrame = QFrame(self.splitter)
        self.DataFrame.setObjectName(u"DataFrame")
        sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy3.setHorizontalStretch(2)
        sizePolicy3.setVerticalStretch(0)
        sizePolicy3.setHeightForWidth(self.DataFrame.sizePolicy().hasHeightForWidth())
        self.DataFrame.setSizePolicy(sizePolicy3)
        self.DataFrame.setFrameShape(QFrame.NoFrame)
        self.DataFrame.setFrameShadow(QFrame.Raised)
        self.verticalLayout_2 = QVBoxLayout(self.DataFrame)
        self.verticalLayout_2.setSpacing(2)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.DataCaptionFrame = QFrame(self.DataFrame)
        self.DataCaptionFrame.setObjectName(u"DataCaptionFrame")
        self.DataCaptionFrame.setFrameShape(QFrame.NoFrame)
        self.DataCaptionFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout_2 = QHBoxLayout(self.DataCaptionFrame)
        self.horizontalLayout_2.setSpacing(2)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.DataLbl = QLabel(self.DataCaptionFrame)
        self.DataLbl.setObjectName(u"DataLbl")

        self.horizontalLayout_2.addWidget(self.DataLbl)

        self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.horizontalLayout_2.addItem(self.horizontalSpacer_3)

        self.AddDataButton = QPushButton(self.DataCaptionFrame)
        self.AddDataButton.setObjectName(u"AddDataButton")

        self.horizontalLayout_2.addWidget(self.AddDataButton)

        self.RemoveDataButton = QPushButton(self.DataCaptionFrame)
        self.RemoveDataButton.setObjectName(u"RemoveDataButton")

        self.horizontalLayout_2.addWidget(self.RemoveDataButton)


        self.verticalLayout_2.addWidget(self.DataCaptionFrame)

        self.DataTable = QTableView(self.DataFrame)
        self.DataTable.setObjectName(u"DataTable")
        self.DataTable.setEditTriggers(QAbstractItemView.AnyKeyPressed|QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked)
        self.DataTable.setAlternatingRowColors(True)
        self.DataTable.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.DataTable.verticalHeader().setVisible(False)
        self.DataTable.verticalHeader().setMinimumSectionSize(20)
        self.DataTable.verticalHeader().setDefaultSectionSize(20)

        self.verticalLayout_2.addWidget(self.DataTable)

        self.splitter.addWidget(self.DataFrame)

        self.horizontalLayout_3.addWidget(self.splitter)


        self.gridLayout.addWidget(self.frame, 3, 0, 1, 5)

        self.NameLbl = QLabel(AssetDialog)
        self.NameLbl.setObjectName(u"NameLbl")

        self.gridLayout.addWidget(self.NameLbl, 0, 0, 1, 1)

        self.isinLbl = QLabel(AssetDialog)
        self.isinLbl.setObjectName(u"isinLbl")

        self.gridLayout.addWidget(self.isinLbl, 1, 0, 1, 1)

        self.BaseAssetSelector = AssetSelector(AssetDialog)
        self.BaseAssetSelector.setObjectName(u"BaseAssetSelector")

        self.gridLayout.addWidget(self.BaseAssetSelector, 2, 1, 1, 1)

        self.ButtonsFrame = QFrame(AssetDialog)
        self.ButtonsFrame.setObjectName(u"ButtonsFrame")
        self.ButtonsFrame.setFrameShape(QFrame.NoFrame)
        self.ButtonsFrame.setFrameShadow(QFrame.Raised)
        self.horizontalLayout = QHBoxLayout(self.ButtonsFrame)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        self.horizontalLayout.addItem(self.horizontalSpacer)

        self.CancelButton = QPushButton(self.ButtonsFrame)
        self.CancelButton.setObjectName(u"CancelButton")

        self.horizontalLayout.addWidget(self.CancelButton)

        self.OkButton = QPushButton(self.ButtonsFrame)
        self.OkButton.setObjectName(u"OkButton")

        self.horizontalLayout.addWidget(self.OkButton)


        self.gridLayout.addWidget(self.ButtonsFrame, 10, 0, 1, 5)

        self.BaseLbl = QLabel(AssetDialog)
        self.BaseLbl.setObjectName(u"BaseLbl")

        self.gridLayout.addWidget(self.BaseLbl, 2, 0, 1, 1)

        self.TypeLbl = QLabel(AssetDialog)
        self.TypeLbl.setObjectName(u"TypeLbl")

        self.gridLayout.addWidget(self.TypeLbl, 1, 3, 1, 1)

        self.isinEdit = QLineEdit(AssetDialog)
        self.isinEdit.setObjectName(u"isinEdit")

        self.gridLayout.addWidget(self.isinEdit, 1, 1, 1, 1)

        self.CountryLbl = QLabel(AssetDialog)
        self.CountryLbl.setObjectName(u"CountryLbl")

        self.gridLayout.addWidget(self.CountryLbl, 2, 3, 1, 1)

        self.CountryCombo = CountryCombo(AssetDialog)
        self.CountryCombo.setObjectName(u"CountryCombo")

        self.gridLayout.addWidget(self.CountryCombo, 2, 4, 1, 1)

        self.TypeCombo = AssetTypeCombo(AssetDialog)
        self.TypeCombo.setObjectName(u"TypeCombo")

        self.gridLayout.addWidget(self.TypeCombo, 1, 4, 1, 1)

        self.NameEdit = QLineEdit(AssetDialog)
        self.NameEdit.setObjectName(u"NameEdit")

        self.gridLayout.addWidget(self.NameEdit, 0, 1, 1, 4)


        self.retranslateUi(AssetDialog)
        self.OkButton.clicked.connect(AssetDialog.accept)
        self.CancelButton.clicked.connect(AssetDialog.reject)

        QMetaObject.connectSlotsByName(AssetDialog)
    # setupUi

    def retranslateUi(self, AssetDialog):
        AssetDialog.setWindowTitle(QCoreApplication.translate("AssetDialog", u"Asset", None))
        self.SymbolsLabel.setText(QCoreApplication.translate("AssetDialog", u"Symbols", None))
        self.AddSymbolButton.setText("")
        self.RemoveSymbolButton.setText("")
        self.DataLbl.setText(QCoreApplication.translate("AssetDialog", u"Extra data", None))
        self.AddDataButton.setText("")
        self.RemoveDataButton.setText("")
        self.NameLbl.setText(QCoreApplication.translate("AssetDialog", u"Name:", None))
        self.isinLbl.setText(QCoreApplication.translate("AssetDialog", u"ISIN:", None))
        self.CancelButton.setText(QCoreApplication.translate("AssetDialog", u"Cancel", None))
        self.OkButton.setText(QCoreApplication.translate("AssetDialog", u"OK", None))
        self.BaseLbl.setText(QCoreApplication.translate("AssetDialog", u"Base asset:", None))
        self.TypeLbl.setText(QCoreApplication.translate("AssetDialog", u"Type: ", None))
        self.CountryLbl.setText(QCoreApplication.translate("AssetDialog", u"Country: ", None))
예제 #6
0
class Ui_OperationsWidget(object):
    def setupUi(self, OperationsWidget):
        if not OperationsWidget.objectName():
            OperationsWidget.setObjectName(u"OperationsWidget")
        OperationsWidget.resize(1232, 552)
        self.verticalLayout_4 = QVBoxLayout(OperationsWidget)
        self.verticalLayout_4.setSpacing(0)
        self.verticalLayout_4.setObjectName(u"verticalLayout_4")
        self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.BalanceOperationsSplitter = QSplitter(OperationsWidget)
        self.BalanceOperationsSplitter.setObjectName(
            u"BalanceOperationsSplitter")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.BalanceOperationsSplitter.sizePolicy().hasHeightForWidth())
        self.BalanceOperationsSplitter.setSizePolicy(sizePolicy)
        self.BalanceOperationsSplitter.setOrientation(Qt.Horizontal)
        self.BalanceBox = QGroupBox(self.BalanceOperationsSplitter)
        self.BalanceBox.setObjectName(u"BalanceBox")
        sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy1.setHorizontalStretch(1)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.BalanceBox.sizePolicy().hasHeightForWidth())
        self.BalanceBox.setSizePolicy(sizePolicy1)
        self.BalanceBox.setMaximumSize(QSize(16777215, 16777215))
        self.verticalLayout = QVBoxLayout(self.BalanceBox)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.BalanceConfigFrame = QFrame(self.BalanceBox)
        self.BalanceConfigFrame.setObjectName(u"BalanceConfigFrame")
        self.BalanceConfigFrame.setMinimumSize(QSize(408, 0))
        self.BalanceConfigFrame.setMaximumSize(QSize(16777215, 44))
        self.BalanceConfigFrame.setFrameShape(QFrame.Panel)
        self.BalanceConfigFrame.setFrameShadow(QFrame.Plain)
        self.BalanceConfigFrame.setLineWidth(0)
        self.horizontalLayout_2 = QHBoxLayout(self.BalanceConfigFrame)
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2)
        self.BalanceDate = QDateEdit(self.BalanceConfigFrame)
        self.BalanceDate.setObjectName(u"BalanceDate")
        self.BalanceDate.setDateTime(
            QDateTime(QDate(2020, 11, 25), QTime(21, 0, 0)))
        self.BalanceDate.setCalendarPopup(True)
        self.BalanceDate.setTimeSpec(Qt.UTC)

        self.horizontalLayout_2.addWidget(self.BalanceDate)

        self.CurrencyLbl = QLabel(self.BalanceConfigFrame)
        self.CurrencyLbl.setObjectName(u"CurrencyLbl")
        self.CurrencyLbl.setLayoutDirection(Qt.LeftToRight)
        self.CurrencyLbl.setAlignment(Qt.AlignRight | Qt.AlignTrailing
                                      | Qt.AlignVCenter)

        self.horizontalLayout_2.addWidget(self.CurrencyLbl)

        self.BalancesCurrencyCombo = CurrencyComboBox(self.BalanceConfigFrame)
        self.BalancesCurrencyCombo.setObjectName(u"BalancesCurrencyCombo")

        self.horizontalLayout_2.addWidget(self.BalancesCurrencyCombo)

        self.ShowInactiveCheckBox = QCheckBox(self.BalanceConfigFrame)
        self.ShowInactiveCheckBox.setObjectName(u"ShowInactiveCheckBox")

        self.horizontalLayout_2.addWidget(self.ShowInactiveCheckBox)

        self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                              QSizePolicy.Minimum)

        self.horizontalLayout_2.addItem(self.horizontalSpacer_2)

        self.verticalLayout.addWidget(self.BalanceConfigFrame)

        self.BalancesTableView = QTableView(self.BalanceBox)
        self.BalancesTableView.setObjectName(u"BalancesTableView")
        self.BalancesTableView.setFrameShape(QFrame.Panel)
        self.BalancesTableView.setEditTriggers(
            QAbstractItemView.EditKeyPressed
            | QAbstractItemView.SelectedClicked)
        self.BalancesTableView.setAlternatingRowColors(True)
        self.BalancesTableView.setSelectionMode(QAbstractItemView.NoSelection)
        self.BalancesTableView.setGridStyle(Qt.DotLine)
        self.BalancesTableView.setWordWrap(False)
        self.BalancesTableView.verticalHeader().setVisible(False)
        self.BalancesTableView.verticalHeader().setMinimumSectionSize(20)
        self.BalancesTableView.verticalHeader().setDefaultSectionSize(20)

        self.verticalLayout.addWidget(self.BalancesTableView)

        self.BalanceOperationsSplitter.addWidget(self.BalanceBox)
        self.OperationsBox = QGroupBox(self.BalanceOperationsSplitter)
        self.OperationsBox.setObjectName(u"OperationsBox")
        sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy2.setHorizontalStretch(4)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(
            self.OperationsBox.sizePolicy().hasHeightForWidth())
        self.OperationsBox.setSizePolicy(sizePolicy2)
        self.OperationsBox.setContextMenuPolicy(Qt.DefaultContextMenu)
        self.verticalLayout_2 = QVBoxLayout(self.OperationsBox)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.OperationConfigFrame = QFrame(self.OperationsBox)
        self.OperationConfigFrame.setObjectName(u"OperationConfigFrame")
        self.OperationConfigFrame.setEnabled(True)
        self.OperationConfigFrame.setMinimumSize(QSize(0, 0))
        self.OperationConfigFrame.setFrameShape(QFrame.Panel)
        self.OperationConfigFrame.setFrameShadow(QFrame.Plain)
        self.OperationConfigFrame.setLineWidth(0)
        self.horizontalLayout_3 = QHBoxLayout(self.OperationConfigFrame)
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.horizontalLayout_3.setContentsMargins(2, 2, 2, 2)
        self.DateRange = DateRangeSelector(self.OperationConfigFrame)
        self.DateRange.setObjectName(u"DateRange")
        self.DateRange.setProperty("ItemsList", u"week;month;quarter;year;all")

        self.horizontalLayout_3.addWidget(self.DateRange)

        self.AccountLbl = QLabel(self.OperationConfigFrame)
        self.AccountLbl.setObjectName(u"AccountLbl")

        self.horizontalLayout_3.addWidget(self.AccountLbl)

        self.ChooseAccountBtn = AccountButton(self.OperationConfigFrame)
        self.ChooseAccountBtn.setObjectName(u"ChooseAccountBtn")

        self.horizontalLayout_3.addWidget(self.ChooseAccountBtn)

        self.SearchLbl = QLabel(self.OperationConfigFrame)
        self.SearchLbl.setObjectName(u"SearchLbl")

        self.horizontalLayout_3.addWidget(self.SearchLbl)

        self.SearchString = QLineEdit(self.OperationConfigFrame)
        self.SearchString.setObjectName(u"SearchString")

        self.horizontalLayout_3.addWidget(self.SearchString)

        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)

        self.horizontalLayout_3.addItem(self.horizontalSpacer)

        self.verticalLayout_2.addWidget(self.OperationConfigFrame)

        self.OperationsDetailsSplitter = QSplitter(self.OperationsBox)
        self.OperationsDetailsSplitter.setObjectName(
            u"OperationsDetailsSplitter")
        self.OperationsDetailsSplitter.setOrientation(Qt.Vertical)
        self.OperationsTableView = QTableView(self.OperationsDetailsSplitter)
        self.OperationsTableView.setObjectName(u"OperationsTableView")
        sizePolicy3 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy3.setHorizontalStretch(0)
        sizePolicy3.setVerticalStretch(4)
        sizePolicy3.setHeightForWidth(
            self.OperationsTableView.sizePolicy().hasHeightForWidth())
        self.OperationsTableView.setSizePolicy(sizePolicy3)
        self.OperationsTableView.setAlternatingRowColors(True)
        self.OperationsTableView.setSelectionMode(
            QAbstractItemView.ExtendedSelection)
        self.OperationsTableView.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.OperationsTableView.setWordWrap(False)
        self.OperationsDetailsSplitter.addWidget(self.OperationsTableView)
        self.OperationsTableView.verticalHeader().setVisible(False)
        self.OperationsTableView.verticalHeader().setMinimumSectionSize(20)
        self.OperationsTableView.verticalHeader().setDefaultSectionSize(20)
        self.OperationDetails = QFrame(self.OperationsDetailsSplitter)
        self.OperationDetails.setObjectName(u"OperationDetails")
        sizePolicy4 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy4.setHorizontalStretch(0)
        sizePolicy4.setVerticalStretch(1)
        sizePolicy4.setHeightForWidth(
            self.OperationDetails.sizePolicy().hasHeightForWidth())
        self.OperationDetails.setSizePolicy(sizePolicy4)
        self.OperationDetails.setMinimumSize(QSize(0, 100))
        self.OperationDetails.setMaximumSize(QSize(16777215, 300))
        self.OperationDetails.setFrameShape(QFrame.Panel)
        self.OperationDetails.setFrameShadow(QFrame.Sunken)
        self.OperationDetails.setLineWidth(1)
        self.horizontalLayout_4 = QHBoxLayout(self.OperationDetails)
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.OperationsTabs = QStackedWidget(self.OperationDetails)
        self.OperationsTabs.setObjectName(u"OperationsTabs")
        self.NoOperation = QWidget()
        self.NoOperation.setObjectName(u"NoOperation")
        self.OperationsTabs.addWidget(self.NoOperation)
        self.IncomeSpending = IncomeSpendingWidget()
        self.IncomeSpending.setObjectName(u"IncomeSpending")
        self.OperationsTabs.addWidget(self.IncomeSpending)
        self.Dividend = DividendWidget()
        self.Dividend.setObjectName(u"Dividend")
        self.OperationsTabs.addWidget(self.Dividend)
        self.Trade = TradeWidget()
        self.Trade.setObjectName(u"Trade")
        self.OperationsTabs.addWidget(self.Trade)
        self.Transfer = TransferWidget()
        self.Transfer.setObjectName(u"Transfer")
        self.OperationsTabs.addWidget(self.Transfer)
        self.CorporateAction = CorporateActionWidget()
        self.CorporateAction.setObjectName(u"CorporateAction")
        self.OperationsTabs.addWidget(self.CorporateAction)

        self.horizontalLayout_4.addWidget(self.OperationsTabs)

        self.OperationsButtons = QFrame(self.OperationDetails)
        self.OperationsButtons.setObjectName(u"OperationsButtons")
        self.verticalLayout_3 = QVBoxLayout(self.OperationsButtons)
        self.verticalLayout_3.setSpacing(2)
        self.verticalLayout_3.setObjectName(u"verticalLayout_3")
        self.verticalLayout_3.setContentsMargins(2, 2, 2, 2)
        self.NewOperationBtn = QPushButton(self.OperationsButtons)
        self.NewOperationBtn.setObjectName(u"NewOperationBtn")

        self.verticalLayout_3.addWidget(self.NewOperationBtn)

        self.CopyOperationBtn = QPushButton(self.OperationsButtons)
        self.CopyOperationBtn.setObjectName(u"CopyOperationBtn")

        self.verticalLayout_3.addWidget(self.CopyOperationBtn)

        self.DeleteOperationBtn = QPushButton(self.OperationsButtons)
        self.DeleteOperationBtn.setObjectName(u"DeleteOperationBtn")

        self.verticalLayout_3.addWidget(self.DeleteOperationBtn)

        self.verticalSpacer_4 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                            QSizePolicy.Expanding)

        self.verticalLayout_3.addItem(self.verticalSpacer_4)

        self.horizontalLayout_4.addWidget(self.OperationsButtons)

        self.OperationsDetailsSplitter.addWidget(self.OperationDetails)

        self.verticalLayout_2.addWidget(self.OperationsDetailsSplitter)

        self.BalanceOperationsSplitter.addWidget(self.OperationsBox)

        self.verticalLayout_4.addWidget(self.BalanceOperationsSplitter)

        self.retranslateUi(OperationsWidget)

        self.OperationsTabs.setCurrentIndex(5)

        QMetaObject.connectSlotsByName(OperationsWidget)

    # setupUi

    def retranslateUi(self, OperationsWidget):
        OperationsWidget.setWindowTitle(
            QCoreApplication.translate("OperationsWidget",
                                       u"Operations & Balances", None))
        self.BalanceBox.setTitle(
            QCoreApplication.translate("OperationsWidget", u"Balances", None))
        self.BalanceDate.setDisplayFormat(
            QCoreApplication.translate("OperationsWidget", u"dd/MM/yyyy",
                                       None))
        self.CurrencyLbl.setText(
            QCoreApplication.translate("OperationsWidget", u"Sum Currency:",
                                       None))
        self.ShowInactiveCheckBox.setText(
            QCoreApplication.translate("OperationsWidget", u"Show &Inactive",
                                       None))
        self.OperationsBox.setTitle(
            QCoreApplication.translate("OperationsWidget", u"Operations",
                                       None))
        self.AccountLbl.setText(
            QCoreApplication.translate("OperationsWidget", u"Account:", None))
        self.SearchLbl.setText(
            QCoreApplication.translate("OperationsWidget", u"Search:", None))
        #if QT_CONFIG(tooltip)
        self.NewOperationBtn.setToolTip(
            QCoreApplication.translate("OperationsWidget", u"New operation",
                                       None))
        #endif // QT_CONFIG(tooltip)
        self.NewOperationBtn.setText("")
        #if QT_CONFIG(tooltip)
        self.CopyOperationBtn.setToolTip(
            QCoreApplication.translate("OperationsWidget", u"Copy operation",
                                       None))
        #endif // QT_CONFIG(tooltip)
        self.CopyOperationBtn.setText("")
        #if QT_CONFIG(tooltip)
        self.DeleteOperationBtn.setToolTip(
            QCoreApplication.translate("OperationsWidget", u"Delete operation",
                                       None))
        #endif // QT_CONFIG(tooltip)
        self.DeleteOperationBtn.setText("")
예제 #7
0
class Ui_JAL_MainWindow(object):
    def setupUi(self, JAL_MainWindow):
        if not JAL_MainWindow.objectName():
            JAL_MainWindow.setObjectName(u"JAL_MainWindow")
        JAL_MainWindow.resize(835, 436)
        JAL_MainWindow.setMinimumSize(QSize(0, 0))
        self.actionExit = QAction(JAL_MainWindow)
        self.actionExit.setObjectName(u"actionExit")
        self.actionExit.setMenuRole(QAction.QuitRole)
        self.action_Re_build_Ledger = QAction(JAL_MainWindow)
        self.action_Re_build_Ledger.setObjectName(u"action_Re_build_Ledger")
        self.action_LoadQuotes = QAction(JAL_MainWindow)
        self.action_LoadQuotes.setObjectName(u"action_LoadQuotes")
        self.actionImportStatement = QAction(JAL_MainWindow)
        self.actionImportStatement.setObjectName(u"actionImportStatement")
        self.actionAccountTypes = QAction(JAL_MainWindow)
        self.actionAccountTypes.setObjectName(u"actionAccountTypes")
        self.actionAccounts = QAction(JAL_MainWindow)
        self.actionAccounts.setObjectName(u"actionAccounts")
        self.actionAssets = QAction(JAL_MainWindow)
        self.actionAssets.setObjectName(u"actionAssets")
        self.actionPeers = QAction(JAL_MainWindow)
        self.actionPeers.setObjectName(u"actionPeers")
        self.actionCategories = QAction(JAL_MainWindow)
        self.actionCategories.setObjectName(u"actionCategories")
        self.actionBackup = QAction(JAL_MainWindow)
        self.actionBackup.setObjectName(u"actionBackup")
        self.actionRestore = QAction(JAL_MainWindow)
        self.actionRestore.setObjectName(u"actionRestore")
        self.PrepareTaxForms = QAction(JAL_MainWindow)
        self.PrepareTaxForms.setObjectName(u"PrepareTaxForms")
        self.MakeDealsReport = QAction(JAL_MainWindow)
        self.MakeDealsReport.setObjectName(u"MakeDealsReport")
        self.actionTags = QAction(JAL_MainWindow)
        self.actionTags.setObjectName(u"actionTags")
        self.MakePLReport = QAction(JAL_MainWindow)
        self.MakePLReport.setObjectName(u"MakePLReport")
        self.MakeCategoriesReport = QAction(JAL_MainWindow)
        self.MakeCategoriesReport.setObjectName(u"MakeCategoriesReport")
        self.actionImportSlipRU = QAction(JAL_MainWindow)
        self.actionImportSlipRU.setObjectName(u"actionImportSlipRU")
        self.actionCountries = QAction(JAL_MainWindow)
        self.actionCountries.setObjectName(u"actionCountries")
        self.actionQuotes = QAction(JAL_MainWindow)
        self.actionQuotes.setObjectName(u"actionQuotes")
        self.actionOperations = QAction(JAL_MainWindow)
        self.actionOperations.setObjectName(u"actionOperations")
        self.centralwidget = QWidget(JAL_MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.centralwidget.setMaximumSize(QSize(16777215, 16777215))
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.splitter = QSplitter(self.centralwidget)
        self.splitter.setObjectName(u"splitter")
        self.splitter.setOrientation(Qt.Vertical)
        self.mdiArea = TabbedMdiArea(self.splitter)
        self.mdiArea.setObjectName(u"mdiArea")
        self.splitter.addWidget(self.mdiArea)
        self.Logs = LogViewer(self.splitter)
        self.Logs.setObjectName(u"Logs")
        self.splitter.addWidget(self.Logs)

        self.verticalLayout.addWidget(self.splitter)

        JAL_MainWindow.setCentralWidget(self.centralwidget)
        self.MainMenu = QMenuBar(JAL_MainWindow)
        self.MainMenu.setObjectName(u"MainMenu")
        self.MainMenu.setGeometry(QRect(0, 0, 835, 23))
        self.menuMain = QMenu(self.MainMenu)
        self.menuMain.setObjectName(u"menuMain")
        self.menu_Data = QMenu(self.MainMenu)
        self.menu_Data.setObjectName(u"menu_Data")
        self.menuPredefined_data = QMenu(self.menu_Data)
        self.menuPredefined_data.setObjectName(u"menuPredefined_data")
        self.menu_Export = QMenu(self.MainMenu)
        self.menu_Export.setObjectName(u"menu_Export")
        self.menuLanguage = QMenu(self.MainMenu)
        self.menuLanguage.setObjectName(u"menuLanguage")
        self.menuImport = QMenu(self.MainMenu)
        self.menuImport.setObjectName(u"menuImport")
        self.menuStatement = QMenu(self.menuImport)
        self.menuStatement.setObjectName(u"menuStatement")
        self.menuReports = QMenu(self.MainMenu)
        self.menuReports.setObjectName(u"menuReports")
        JAL_MainWindow.setMenuBar(self.MainMenu)
        self.StatusBar = QStatusBar(JAL_MainWindow)
        self.StatusBar.setObjectName(u"StatusBar")
        JAL_MainWindow.setStatusBar(self.StatusBar)

        self.MainMenu.addAction(self.menuMain.menuAction())
        self.MainMenu.addAction(self.menu_Data.menuAction())
        self.MainMenu.addAction(self.menuReports.menuAction())
        self.MainMenu.addAction(self.menuImport.menuAction())
        self.MainMenu.addAction(self.menu_Export.menuAction())
        self.MainMenu.addAction(self.menuLanguage.menuAction())
        self.menuMain.addAction(self.actionOperations)
        self.menuMain.addAction(self.actionExit)
        self.menu_Data.addSeparator()
        self.menu_Data.addAction(self.actionAccounts)
        self.menu_Data.addAction(self.actionAssets)
        self.menu_Data.addAction(self.actionPeers)
        self.menu_Data.addAction(self.actionCategories)
        self.menu_Data.addAction(self.actionTags)
        self.menu_Data.addAction(self.actionCountries)
        self.menu_Data.addAction(self.actionQuotes)
        self.menu_Data.addAction(self.menuPredefined_data.menuAction())
        self.menu_Data.addSeparator()
        self.menu_Data.addAction(self.actionBackup)
        self.menu_Data.addAction(self.actionRestore)
        self.menu_Data.addSeparator()
        self.menu_Data.addAction(self.action_Re_build_Ledger)
        self.menuPredefined_data.addAction(self.actionAccountTypes)
        self.menu_Export.addAction(self.PrepareTaxForms)
        self.menuImport.addAction(self.action_LoadQuotes)
        self.menuImport.addAction(self.menuStatement.menuAction())
        self.menuImport.addAction(self.actionImportSlipRU)

        self.retranslateUi(JAL_MainWindow)

        QMetaObject.connectSlotsByName(JAL_MainWindow)

    # setupUi

    def retranslateUi(self, JAL_MainWindow):
        JAL_MainWindow.setWindowTitle(
            QCoreApplication.translate("JAL_MainWindow", u"jal", None))
        self.actionExit.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Exit", None))
        self.action_Re_build_Ledger.setText(
            QCoreApplication.translate("JAL_MainWindow",
                                       u"Re-build &Ledger...", None))
        self.action_LoadQuotes.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Quotes...", None))
        self.actionImportStatement.setText(
            QCoreApplication.translate("JAL_MainWindow",
                                       u"&Broker statement...", None))
        self.actionAccountTypes.setText(
            QCoreApplication.translate("JAL_MainWindow", u"Account &Types",
                                       None))
        self.actionAccounts.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Accounts", None))
        self.actionAssets.setText(
            QCoreApplication.translate("JAL_MainWindow", u"A&ssets", None))
        self.actionPeers.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Peers", None))
        self.actionCategories.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Categories", None))
        self.actionBackup.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Backup...", None))
        self.actionRestore.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Restore...", None))
        self.PrepareTaxForms.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Tax report [RU]",
                                       None))
        self.MakeDealsReport.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Deals report",
                                       None))
        self.actionTags.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Tags", None))
        self.MakePLReport.setText(
            QCoreApplication.translate("JAL_MainWindow",
                                       u"&Profit/Loss report", None))
        self.MakeCategoriesReport.setText(
            QCoreApplication.translate("JAL_MainWindow",
                                       u"&Income/Spending report", None))
        self.actionImportSlipRU.setText(
            QCoreApplication.translate("JAL_MainWindow", u"Slip [RU]...",
                                       None))
        self.actionCountries.setText(
            QCoreApplication.translate("JAL_MainWindow", u"C&ountries", None))
        self.actionQuotes.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Quotes", None))
        self.actionOperations.setText(
            QCoreApplication.translate("JAL_MainWindow", u"&Operations", None))
        self.menuMain.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Main", None))
        self.menu_Data.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Data", None))
        self.menuPredefined_data.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"Predefined data",
                                       None))
        self.menu_Export.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Export", None))
        self.menuLanguage.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"L&anguage", None))
        self.menuImport.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Import", None))
        self.menuStatement.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Statement", None))
        self.menuReports.setTitle(
            QCoreApplication.translate("JAL_MainWindow", u"&Reports", None))