Exemple #1
0
    def createSequencerControls(self):
        widget = QWidget()
        layout = QVBoxLayout()

        layout.addWidget(self.createSequencerSections(1))
        layout.addWidget(self.createSequencerSections(2))
        layout.addWidget(self.createRhythmSection())

        hbox = Qtw.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(self.createTransportSection())
        hbox.addWidget(self.createEnvSection())
        hbox.setStretch(0, 1)
        hbox.setStretch(1, 1)

        layout.addLayout(hbox)

        layout.setContentsMargins(0, 0, 0, 0)
        widget.setContentsMargins(0, 0, 0, 0)
        layout.setStretch(0, 2)
        layout.setStretch(1, 2)
        layout.setStretch(2, 4)
        layout.setStretch(3, 2)

        widget.setLayout(layout)
        return widget
Exemple #2
0
class DataView(object):
    uifile = QDir(os.path.dirname(os.path.realpath(__file__)))

    def setupUi(self, Form):
        if not Form.objectName():
            Form.setObjectName(u"Form")
        Form.resize(529, 777)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.stepsLayout = QVBoxLayout()
        self.stepsLayout.setSpacing(10)
        self.stepsLayout.setObjectName(u"stepsLayout")
        self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize)
        self.stepsLayout.setContentsMargins(0, 0, 0, 0)

        self.verticalLayout.addLayout(self.stepsLayout)

        self.retranslateUi(Form)

        QMetaObject.connectSlotsByName(Form)

    # setupUi

    def retranslateUi(self, form):
        form.setWindowTitle(
            QCoreApplication.translate(b"dataPane", b"dataPane", None))
class ModeBasedListView(QWidget):
    def __init__(self, clipboard):
        QWidget.__init__(self)
        self.layout = QVBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.session_bar = SessionBar(clipboard)
        self.layout.addWidget(self.session_bar)

        self.list_view = ListItemView()
        self.layout.addWidget(self.list_view)

        self.setLayout(self.layout)

    def update(self, prefix, elapsed, fame, fame_per_hour,
               players: PlayerListItem):
        self.session_bar.player_stats.update(elapsed, fame, fame_per_hour)
        self.session_bar.copy_button.update(
            prefix, self.list_view.get_player_list_items(),
            self.session_bar.mode.get_mode(), fame)
        self.list_view.update(players)
        self.session_bar.update()

    def get_mode(self) -> str:
        return self.session_bar.mode.get_mode()
Exemple #4
0
class SideMenuWidget(QWidget):
    def __init__(self):
        super(SideMenuWidget, self).__init__()
        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(12)
        self.setLayout(self.layout)

        # PROFILE
        self.layout.addWidget(Profile())

        # BUTTONS
        self.listview = ListView()
        self.listview.setFrameStyle(QFrame.NoFrame)
        self.listview.setFocusPolicy(Qt.NoFocus)
        self.listview.setModel(Model())
        self.listview.setItemDelegate(Delegate())
        self.layout.addWidget(self.listview)

        # LABELS
        self.labels = QWidget()
        self.labels.setFixedHeight(60)
        self.layout.addWidget(self.labels)

        _margins = 16  # left margin

        self.app_name = LinkLabel(self.labels, "color: rgba(0, 0, 0, 80%)",
                                  "color: rgba(0, 0, 0, 60%)")
        self.app_name.setText("sidemenu app")
        self.app_name.setFont(QFont("Roboto Light", 12))
        self.app_name.move(self.labels.x() + _margins, self.labels.y())

        self.app_ver = LinkLabel(self.labels, "color: rgba(0, 0, 0, 60%)",
                                 "color: rgba(0, 0, 0, 60%)")
        self.app_ver.setText("Версия 1.0.0")
        self.app_ver.setFont(QFont("Roboto Light", 11))
        self.app_ver.move(self.labels.x() + _margins,
                          self.labels.y() + _margins * 2)

        self.lbl = QLabel(self.labels)
        self.lbl.setText("-")
        self.lbl.setStyleSheet("color: rgba(0, 0, 0, 60%)")
        self.lbl.setFont(QFont("Roboto Light", 11))
        self.lbl.move(self.labels.x() + _margins * 7,
                      self.labels.y() + _margins * 2)

        self.app_about = LinkLabel(self.labels, "color: rgba(0, 0, 0, 60%)",
                                   "color: rgba(0, 0, 0, 60%)")
        self.app_about.setText("О программе")
        self.app_about.setFont(QFont("Roboto Light", 11))
        self.app_about.move(self.labels.x() + _margins * 8,
                            self.labels.y() + _margins * 2)

        self.setStyleSheet("background: white;")

    def paintEvent(self, event):
        opt = QStyleOption()
        opt.initFrom(self)
        p = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self)
Exemple #5
0
    def __init__(self, *args, **kwargs):
        super(FramelessWindow, self).__init__(*args, **kwargs)
        self._pressed = False
        self.Direction = None
        self.resize(760, 580)

        # Фон прозрачный
        self.setAttribute(Qt.WA_TranslucentBackground, True)

        # Нет границы
        self.setWindowFlag(Qt.FramelessWindowHint)
        # Отслеживание мыши
        self.setMouseTracking(True)

        # макет
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # Зарезервировать границы для изменения размера окна без полей
        layout.setContentsMargins(self.Margins, self.Margins, self.Margins,
                                  self.Margins)
        # Панель заголовка
        self.titleBar = TitleBar(self)
        layout.addWidget(self.titleBar)

        # слот сигнала
        self.titleBar.windowMinimumed.connect(self.showMinimized)
        self.titleBar.windowMaximumed.connect(self.showMaximized)
        self.titleBar.windowNormaled.connect(self.showNormal)
        self.titleBar.windowClosed.connect(self.close)
        self.titleBar.windowMoved.connect(self.move)
        self.windowTitleChanged.connect(self.titleBar.setTitle)
        self.windowIconChanged.connect(self.titleBar.setIcon)
class EditIconWidget(TritonWidget):
    def __init__(self, base, name, callback, *args, **kwargs):
        TritonWidget.__init__(self, base, *args, **kwargs)
        self.callback = callback

        self.setWindowTitle(name)
        self.setBackgroundColor(self, Qt.white)

        self.boxLayout = QVBoxLayout(self)
        self.boxLayout.setContentsMargins(0, 5, 0, 0)
        layout = None

        for i, icon in enumerate(os.listdir('icons')):
            if (not layout) or i % 10 == 0:
                widget = QWidget()
                layout = QHBoxLayout(widget)
                layout.setContentsMargins(5, 5, 5, 5)
                self.boxLayout.addWidget(widget)

            name = os.path.join('icons', icon)
            button = PixmapButton(QPixmap(name).scaled(48, 48))
            button.clicked.connect(self.makeIconCallback(name))
            button.setToolTip(icon)
            layout.addWidget(button)

        self.setFixedSize(self.sizeHint())
        self.center()
        self.show()

    def makeIconCallback(self, name):
        def iconCallback():
            self.callback(name)
            self.close()

        return iconCallback
Exemple #7
0
 def __init__(self, parent, view, data):
     super(ExportsWidget, self).__init__(parent)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self.imports = ExportsTreeView(self, view, data)
     self.filter = FilteredView(self, self.imports, self.imports)
     layout.addWidget(self.filter, 1)
     self.setLayout(layout)
     self.setMinimumSize(UIContext.getScaledWindowSize(100, 196))
    def init_common_ui(self):
        height = self.screen().size().height() // 5
        self.resize(height * 5 // 3, height)
        self.setWindowTitle('cappuccino')

        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(QMargins(0, 0, 0, 0))
        self.setLayout(vbox)

        self.init_menu()
Exemple #9
0
 def __init__(self, *args, **kwargs):
     super(QtBubbleLabel, self).__init__(*args, **kwargs)
     self.setWindowFlags(Qt.Window | Qt.Tool | Qt.FramelessWindowHint
                         | Qt.WindowStaysOnTopHint
                         | Qt.X11BypassWindowManagerHint)
     self.setMinimumWidth(200)
     self.setMinimumHeight(48)
     self.setAttribute(Qt.WA_TranslucentBackground, True)
     layout = QVBoxLayout(self)
     layout.setContentsMargins(8, 8, 8, 16)
     self.label = QLabel(self)
     layout.addWidget(self.label)
     self.animationGroup = QParallelAnimationGroup(self)
Exemple #10
0
def test_pixmap(pixmap_differ: PixmapDiffer):
    actual: QPainter
    expected: QPainter
    with pixmap_differ.create_painters(300, 240,
                                       'scaled_label_pixmap') as (actual,
                                                                  expected):
        ex_widget = QWidget()
        ex_widget.resize(300, 240)
        expected.drawPixmap(0, 0, ex_widget.grab())
        icon = GridDisplay.create_icon(GridDisplay.player2_colour)

        expected.drawPixmap(
            0, 0,
            icon.scaled(120, 120, Qt.KeepAspectRatio, Qt.SmoothTransformation))
        expected.drawPixmap(
            110, 120,
            icon.scaled(80, 80, Qt.KeepAspectRatio, Qt.SmoothTransformation))
        expected.drawPixmap(
            260, 200,
            icon.scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation))

        widget = QWidget()
        layout = QVBoxLayout(widget)
        label1 = ScaledLabel()
        label2 = ScaledLabel()
        label3 = ScaledLabel()
        label1.setPixmap(icon)
        label2.setPixmap(icon)
        label3.setPixmap(icon)
        size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        label1.setSizePolicy(size_policy)
        label2.setSizePolicy(size_policy)
        label3.setSizePolicy(size_policy)
        label1.setScaledContents(True)
        label2.setScaledContents(True)
        label3.setScaledContents(True)
        label1.setAlignment(Qt.AlignLeft)
        label2.setAlignment(Qt.AlignCenter)
        label3.setAlignment(Qt.AlignRight)
        layout.addWidget(label1)
        layout.addWidget(label2)
        layout.addWidget(label3)
        layout.setStretch(0, 3)
        layout.setStretch(1, 2)
        layout.setStretch(2, 1)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        widget.resize(300, 240)

        actual.drawPixmap(0, 0, widget.grab())
Exemple #11
0
    def draw_board(self, file_config):
        """Initiate UI

        The UI consists of 2 parts, top is the board title and info
        and button is the subbords with tiles in each ones
        the subboard is drawn based on file_configuration
        """
        config, content = file_config

        mainlayout = QVBoxLayout()
        mainlayout.setContentsMargins(20, 20, 20, 20)

        title_edit = QLineEdit(
            config["xban_config"]["title"],
            objectName="windowEdit_title",
            parent=self,
        )
        title_edit.setPlaceholderText("Enter title here ...")

        info_edit = NoteTile(config["xban_config"]["description"],
                             "windowEdit_text", self)
        info_edit.setPlaceholderText("Enter description here ...")

        mainlayout.addWidget(title_edit)
        mainlayout.addWidget(info_edit)

        self.sublayout = QHBoxLayout()
        color = config["xban_config"]["board_color"]
        self.sublayout.setContentsMargins(10, 10, 10, 10)

        self.sublayout.setSpacing(20)

        add_btn = BanButton(
            "+",
            clicked=self.insert_board,
            toolTip="add board",
            objectName="windowBtn_add",
        )
        shadow = QGraphicsDropShadowEffect(self,
                                           blurRadius=10,
                                           offset=5,
                                           color=QColor("lightgrey"))
        add_btn.setGraphicsEffect(shadow)
        self.sublayout.addWidget(add_btn)

        mainlayout.addLayout(self.sublayout)
        self.setLayout(mainlayout)

        for i, tile_contents in enumerate(content.items()):
            # insert the boards
            self.insert_board(tile_contents, color[i])
Exemple #12
0
    def createMainSection(self):
        widget = QWidget()
        layout = QVBoxLayout()

        layout.addWidget(self.createTopControls())
        layout.addWidget(self.createBottomControls())

        layout.setStretch(0, 5)
        layout.setStretch(1, 1)

        widget.setLayout(layout)
        layout.setContentsMargins(0, 0, 0, 0)
        widget.setContentsMargins(0, 0, 0, 0)
        return widget
Exemple #13
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(400, 120)
        Dialog.setMinimumSize(QSize(400, 120))
        Dialog.setMaximumSize(QSize(400, 120))
        self.verticalLayout = QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(9, 9, 9, 9)
        self.bg_diag = QFrame(Dialog)
        self.bg_diag.setObjectName(u"bg_diag")
        self.bg_diag.setStyleSheet(u"background-color: rgb(29, 0, 86);\n"
                                   "border-radius: 10px;")
        self.bg_diag.setFrameShape(QFrame.NoFrame)
        self.bg_diag.setFrameShadow(QFrame.Raised)
        self.tittle_bar = QFrame(self.bg_diag)
        self.tittle_bar.setObjectName(u"tittle_bar")
        self.tittle_bar.setGeometry(QRect(10, 10, 361, 31))
        self.tittle_bar.setFrameShape(QFrame.StyledPanel)
        self.tittle_bar.setFrameShadow(QFrame.Raised)
        self.lbl_falhaLogar = QLabel(self.tittle_bar)
        self.lbl_falhaLogar.setObjectName(u"lbl_falhaLogar")
        self.lbl_falhaLogar.setGeometry(QRect(64, -9, 241, 41))
        self.lbl_falhaLogar.setStyleSheet(u"color: rgb(255, 255, 255);\n"
                                          "font: 18pt \"Segoe UI\";")
        self.pushButton = QPushButton(self.bg_diag)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setGeometry(QRect(161, 60, 61, 31))
        self.pushButton.setStyleSheet(u"background-color: rgb(53, 159, 159);\n"
                                      "color: rgb(255, 255, 255);\n"
                                      "font: 18pt \"Segoe UI\";\n"
                                      "")

        self.verticalLayout.addWidget(self.bg_diag)

        self.retranslateUi(Dialog)

        QMetaObject.connectSlotsByName(Dialog)

    # setupUi

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QCoreApplication.translate("Dialog", u"Dialog", None))
        self.lbl_falhaLogar.setText(
            QCoreApplication.translate("Dialog",
                                       u"Falha ao logar usu\u00e1rio", None))
        self.pushButton.setText(
            QCoreApplication.translate("Dialog", u"Ok", None))
class Ui_IncomeSpendingReportWidget(object):
    def setupUi(self, IncomeSpendingReportWidget):
        if not IncomeSpendingReportWidget.objectName():
            IncomeSpendingReportWidget.setObjectName(
                u"IncomeSpendingReportWidget")
        IncomeSpendingReportWidget.resize(595, 347)
        self.verticalLayout = QVBoxLayout(IncomeSpendingReportWidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.ReportParamsFrame = QFrame(IncomeSpendingReportWidget)
        self.ReportParamsFrame.setObjectName(u"ReportParamsFrame")
        self.ReportParamsFrame.setFrameShape(QFrame.Panel)
        self.ReportParamsFrame.setFrameShadow(QFrame.Sunken)
        self.horizontalLayout = QHBoxLayout(self.ReportParamsFrame)
        self.horizontalLayout.setSpacing(6)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(2, 2, 2, 2)
        self.ReportRange = DateRangeSelector(self.ReportParamsFrame)
        self.ReportRange.setObjectName(u"ReportRange")
        self.ReportRange.setProperty("ItemsList",
                                     u"QTD;YTD;this_year;last_year")

        self.horizontalLayout.addWidget(self.ReportRange)

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

        self.horizontalLayout.addItem(self.horizontalSpacer)

        self.verticalLayout.addWidget(self.ReportParamsFrame)

        self.ReportTreeView = QTreeView(IncomeSpendingReportWidget)
        self.ReportTreeView.setObjectName(u"ReportTreeView")
        self.ReportTreeView.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.ReportTreeView.setAlternatingRowColors(True)
        self.ReportTreeView.header().setStretchLastSection(False)

        self.verticalLayout.addWidget(self.ReportTreeView)

        self.retranslateUi(IncomeSpendingReportWidget)

        QMetaObject.connectSlotsByName(IncomeSpendingReportWidget)

    # setupUi

    def retranslateUi(self, IncomeSpendingReportWidget):
        IncomeSpendingReportWidget.setWindowTitle(
            QCoreApplication.translate("IncomeSpendingReportWidget",
                                       u"Income/Spending", None))
Exemple #15
0
    def __init__(self, maintext, gloss, parent):
        super().__init__(parent)

        self.main_label = QLabel(maintext, self)
        self.main_label.setFont(default_font)

        self.gloss_label = QLabel(gloss, self)
        self.gloss_label.setFont(gloss_font)

        layout = QVBoxLayout()
        layout.addWidget(self.gloss_label)
        layout.addWidget(self.main_label)
        layout.setContentsMargins(1, 1, 1, 1)
        self.setLayout(layout)
    def init_ui(self):
        label = QLabel('カプチーノを入れています...', self)
        label.setAlignment(Qt.AlignCenter)

        pbar = QProgressBar(self)
        pbar.setRange(0, DOUNLOAD_COUNT)
        pbar.setTextVisible(False)

        vbox = QVBoxLayout(self)
        vbox.addWidget(label)
        vbox.addWidget(pbar)
        vbox.setContentsMargins(QMargins(16, 16, 16, 16))
        self.setLayout(vbox)

        self.__progress_bar = pbar
class ShowSecretWidget(TritonWidget):

    def __init__(self, base, keys, name, *args, **kwargs):
        TritonWidget.__init__(self, base, *args, **kwargs)
        self.setWindowTitle(name)
        self.setBackgroundColor(self, Qt.white)

        self.boxLayout = QVBoxLayout(self)
        self.boxLayout.setContentsMargins(20, 20, 20, 20)

        for key in keys:
            name, value = key
            widget = TextboxWidget(base, name)
            widget.box.setText(value)
            self.boxLayout.addWidget(widget)

        self.setFixedSize(self.sizeHint())
        self.center()
        self.show()
Exemple #18
0
    def __init__(self, parent, name, data):
        if not type(data) == BinaryView:
            raise Exception('expected widget data to be a BinaryView')

        self.bv = data

        QWidget.__init__(self, parent)
        DockContextHandler.__init__(self, self, name)
        self.actionHandler = UIActionHandler()
        self.actionHandler.setupActionHandler(self)

        self.table = QTableView(self)
        self.model = DebugThreadsListModel(self.table)
        self.table.setModel(self.model)
        self.table.clicked.connect(self.threadRowClicked)

        self.item_delegate = DebugThreadsItemDelegate(self)
        self.table.setItemDelegate(self.item_delegate)

        # self.table.setSortingEnabled(True)
        self.table.setSelectionBehavior(
            QAbstractItemView.SelectionBehavior.SelectRows)
        self.table.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.table.verticalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)
        self.table.verticalHeader().setVisible(False)

        self.table.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.table.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)

        self.table.resizeColumnsToContents()
        self.table.resizeRowsToContents()
        self.table.horizontalHeader().setSectionResizeMode(
            1, QHeaderView.Stretch)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.table)
        self.setLayout(layout)
Exemple #19
0
    def __init__(self, parent: QWidget, name: str, bv: Optional[BinaryView]):
        """
        Initialize a new NotepadDockWidget.

        :param parent: the QWidget to parent this NotepadDockWidget to
        :param name: the name to register the dock widget under
        :param bv: the currently focused BinaryView (may be None)
        """

        self.bv = bv

        QWidget.__init__(self, parent)
        DockContextHandler.__init__(self, self, name)

        # Set up the save timer to save the current notepad content on timeout.
        self.save_timer = QTimer(self)
        self.save_timer.setSingleShot(True)
        self.save_timer.timeout.connect(lambda: self.store_notes())

        # Initialize the editor and set up the text changed callback.
        self.editor = JMarkdownEditor(self)
        self.editor.textChanged.connect(self.on_editor_text_changed)

        # Create the viewer
        self.viewer = JMarkdownViewer(self, self.editor)

        # Add both widgets to a tab container
        self.tab_container = QTabWidget()
        self.tab_container.addTab(self.viewer, "View")
        self.tab_container.addTab(self.editor, "Edit")

        # Create a simple layout for the editor and set it as the root layout.
        layout = QVBoxLayout()
        layout.addWidget(self.tab_container)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        # Probably does nothing since there should be no BV when the program
        # starts, but needs confirmation, so here it will stay.
        self.query_notes()
Exemple #20
0
	def __init__(self, context):
		super(TriageFilePicker, self).__init__()
		self.context = context
		self.actionHandler = UIActionHandler()
		self.actionHandler.setupActionHandler(self)
		self.contextMenu = Menu()
		self.contextMenuManager = ContextMenuManager(self)

		layout = QVBoxLayout()
		layout.setContentsMargins(0, 0, 0, 0)

		self.model = QFileSystemModel()
		self.model.setRootPath("")
		self.model.setFilter(QDir.AllEntries | QDir.Hidden | QDir.System)
		self.tree = QTreeView(self)
		self.tree.setModel(self.model)
		self.tree.setSelectionMode(QAbstractItemView.ExtendedSelection)
		self.tree.setColumnWidth(0, 500)
		layout.addWidget(self.tree, 1)

		self.setLayout(layout)

		self.tree.doubleClicked.connect(self.onDoubleClick)

		recentFile = QSettings().value("triage/recentFile", os.path.expanduser("~"))
		while len(recentFile) > 0:
			f = self.model.index(recentFile)
			if f.isValid():
				self.tree.scrollTo(f)
				self.tree.setExpanded(f, True)
				break
			parentDir = os.path.dirname(recentFile)
			if parentDir == recentFile:
				break
			recentFile = parentDir

		self.actionHandler.bindAction("Open Selected Files", UIAction(
			lambda context: self.openSelectedFiles(),
			lambda context: self.areFilesSelected()))
		self.contextMenu.addAction("Open Selected Files", "Open")
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(659, 477)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.verticalLayout = QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(50, -1, 50, -1)
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setMinimumSize(QSize(0, 50))
        font = QFont()
        font.setPointSize(16)
        self.pushButton.setFont(font)

        self.verticalLayout.addWidget(self.pushButton)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 659, 27))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)

    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            QCoreApplication.translate("MainWindow", u"MainWindow", None))
        self.pushButton.setText(
            QCoreApplication.translate("MainWindow", u"pushButton", None))
Exemple #22
0
	def __init__(self, parent, name, data):
		if not type(data) == binaryninja.binaryview.BinaryView:
			raise Exception('expected widget data to be a BinaryView')

		self.bv = data

		QWidget.__init__(self, parent)
		DockContextHandler.__init__(self, self, name)
		self.actionHandler = UIActionHandler()
		self.actionHandler.setupActionHandler(self)

		layout = QVBoxLayout()
		self.consoleText = QTextEdit(self)
		self.consoleText.setReadOnly(True)
		self.consoleText.setFont(getMonospaceFont(self))
		layout.addWidget(self.consoleText, 1)

		inputLayout = QHBoxLayout()
		inputLayout.setContentsMargins(4, 4, 4, 4)

		promptLayout = QVBoxLayout()
		promptLayout.setContentsMargins(0, 5, 0, 5)

		inputLayout.addLayout(promptLayout)

		self.consoleEntry = QLineEdit(self)
		inputLayout.addWidget(self.consoleEntry, 1)

		self.entryLabel = QLabel("dbg>>> ", self)
		self.entryLabel.setFont(getMonospaceFont(self))
		promptLayout.addWidget(self.entryLabel)
		promptLayout.addStretch(1)

		self.consoleEntry.returnPressed.connect(lambda: self.sendLine())

		layout.addLayout(inputLayout)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setSpacing(0)
		self.setLayout(layout)
Exemple #23
0
class Ui_Form(object):
    def setupUi(self, Form):
        if not Form.objectName():
            Form.setObjectName(u"Form")
        Form.resize(529, 777)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.stepsLayout = QVBoxLayout()
        self.stepsLayout.setSpacing(10)
        self.stepsLayout.setObjectName(u"stepsLayout")
        self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize)
        self.stepsLayout.setContentsMargins(0, 0, 0, 0)

        self.verticalLayout.addLayout(self.stepsLayout)

        self.retranslateUi(Form)

        QMetaObject.connectSlotsByName(Form)

    # setupUi

    def retranslateUi(self, Form):
        Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None))
Exemple #24
0
    def __init__(self, parent=None):
        super(PhysiCellXMLCreator, self).__init__(parent)

        self.setWindowTitle("PhysiCell configuration")

        # Menus
        lay = QVBoxLayout(self)
        lay.setContentsMargins(5, 35, 5, 5)
        self.menu()
        self.setWindowIcon(self.style().standardIcon(
            getattr(QStyle, 'SP_DialogNoButton')))
        self.grid = QGridLayout()
        lay.addLayout(self.grid)
        self.setLayout(lay)
        self.setMinimumSize(400, 320)

        # self.menubar = QtWidgets.QMenuBar(self)
        # self.file_menu = QtWidgets.QMenu('File')
        # self.file_menu.insertAction("Open")
        # self.menubar.addMenu(self.file_menu)

        # GUI tabs
        config_file = "virus_macrophage.xml"
        tree = ET.parse(config_file)
        xml_root = tree.getroot()

        self.tab1 = Config()
        self.tab1.fill_gui(xml_root)

        self.tab2 = SubstrateDef()
        # self.tab2.fill_gui(xml_root)

        self.tab3 = CellDef()

        self.addTab(self.tab1, "Config Basics")
        self.addTab(self.tab2, "Microenvironment")
        self.addTab(self.tab3, "Cell Types")
Exemple #25
0
class ModernWindow(QWidget):
    """ Modern window.

        Args:
            w (QWidget): Main widget.
            parent (QWidget, optional): Parent widget.
    """
    def __init__(self, w, parent=None):
        QWidget.__init__(self, parent)

        self._w = w
        self.setupUi()

        contentLayout = QHBoxLayout()
        contentLayout.setContentsMargins(0, 0, 0, 0)
        contentLayout.addWidget(w)

        self.windowContent.setLayout(contentLayout)

        self.setWindowTitle(w.windowTitle())
        self.setGeometry(w.geometry())

        # Adding attribute to clean up the parent window when the child is closed
        self._w.setAttribute(Qt.WA_DeleteOnClose, True)
        self._w.destroyed.connect(self.__child_was_closed)

    def setupUi(self):
        # create title bar, content
        self.vboxWindow = QVBoxLayout(self)
        self.vboxWindow.setContentsMargins(0, 0, 0, 0)

        self.windowFrame = QWidget(self)
        self.windowFrame.setObjectName('windowFrame')

        self.vboxFrame = QVBoxLayout(self.windowFrame)
        self.vboxFrame.setContentsMargins(0, 0, 0, 0)

        self.titleBar = WindowDragger(self, self.windowFrame)
        self.titleBar.setObjectName('titleBar')
        self.titleBar.setSizePolicy(
            QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed))

        self.hboxTitle = QHBoxLayout(self.titleBar)
        self.hboxTitle.setContentsMargins(0, 0, 0, 0)
        self.hboxTitle.setSpacing(0)

        self.lblTitle = QLabel('Title')
        self.lblTitle.setObjectName('lblTitle')
        self.lblTitle.setAlignment(Qt.AlignCenter)

        spButtons = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        self.btnMinimize = QToolButton(self.titleBar)
        self.btnMinimize.setObjectName('btnMinimize')
        self.btnMinimize.setSizePolicy(spButtons)

        self.btnRestore = QToolButton(self.titleBar)
        self.btnRestore.setObjectName('btnRestore')
        self.btnRestore.setSizePolicy(spButtons)

        self.btnMaximize = QToolButton(self.titleBar)
        self.btnMaximize.setObjectName('btnMaximize')
        self.btnMaximize.setSizePolicy(spButtons)

        self.btnClose = QToolButton(self.titleBar)
        self.btnClose.setObjectName('btnClose')
        self.btnClose.setSizePolicy(spButtons)

        self.vboxFrame.addWidget(self.titleBar)

        self.windowContent = QWidget(self.windowFrame)
        self.vboxFrame.addWidget(self.windowContent)

        self.vboxWindow.addWidget(self.windowFrame)

        if PLATFORM == "Darwin":
            self.hboxTitle.addWidget(self.btnClose)
            self.hboxTitle.addWidget(self.btnMinimize)
            self.hboxTitle.addWidget(self.btnRestore)
            self.hboxTitle.addWidget(self.btnMaximize)
            self.hboxTitle.addWidget(self.lblTitle)
        else:
            self.hboxTitle.addWidget(self.lblTitle)
            self.hboxTitle.addWidget(self.btnMinimize)
            self.hboxTitle.addWidget(self.btnRestore)
            self.hboxTitle.addWidget(self.btnMaximize)
            self.hboxTitle.addWidget(self.btnClose)

        # set window flags
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowCloseButtonHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint)

        if QT_VERSION >= (5, ):
            self.setAttribute(Qt.WA_TranslucentBackground)

        # set stylesheet
        with open(_FL_STYLESHEET) as stylesheet:
            self.setStyleSheet(stylesheet.read())

        # automatically connect slots
        QMetaObject.connectSlotsByName(self)

    def __child_was_closed(self):
        self._w = None  # The child was deleted, remove the reference to it and close the parent window
        self.close()

    def closeEvent(self, event):
        if not self._w:
            event.accept()
        else:
            self._w.close()
            event.setAccepted(self._w.isHidden())

    def setWindowTitle(self, title):
        """ Set window title.

            Args:
                title (str): Title.
        """

        super(ModernWindow, self).setWindowTitle(title)
        self.lblTitle.setText(title)

    def _setWindowButtonState(self, hint, state):
        btns = {
            Qt.WindowCloseButtonHint: self.btnClose,
            Qt.WindowMinimizeButtonHint: self.btnMinimize,
            Qt.WindowMaximizeButtonHint: self.btnMaximize
        }
        button = btns.get(hint)

        maximized = bool(self.windowState() & Qt.WindowMaximized)

        if button == self.btnMaximize:  # special rules for max/restore
            self.btnRestore.setEnabled(state)
            self.btnMaximize.setEnabled(state)

            if maximized:
                self.btnRestore.setVisible(state)
                self.btnMaximize.setVisible(False)
            else:
                self.btnMaximize.setVisible(state)
                self.btnRestore.setVisible(False)
        else:
            button.setEnabled(state)

        allButtons = [
            self.btnClose, self.btnMinimize, self.btnMaximize, self.btnRestore
        ]
        if True in [b.isEnabled() for b in allButtons]:
            for b in allButtons:
                b.setVisible(True)
            if maximized:
                self.btnMaximize.setVisible(False)
            else:
                self.btnRestore.setVisible(False)
            self.lblTitle.setContentsMargins(0, 0, 0, 0)
        else:
            for b in allButtons:
                b.setVisible(False)
            self.lblTitle.setContentsMargins(0, 2, 0, 0)

    def setWindowFlag(self, Qt_WindowType, on=True):
        buttonHints = [
            Qt.WindowCloseButtonHint, Qt.WindowMinimizeButtonHint,
            Qt.WindowMaximizeButtonHint
        ]

        if Qt_WindowType in buttonHints:
            self._setWindowButtonState(Qt_WindowType, on)
        else:
            QWidget.setWindowFlag(self, Qt_WindowType, on)

    def setWindowFlags(self, Qt_WindowFlags):
        buttonHints = [
            Qt.WindowCloseButtonHint, Qt.WindowMinimizeButtonHint,
            Qt.WindowMaximizeButtonHint
        ]
        for hint in buttonHints:
            self._setWindowButtonState(hint, bool(Qt_WindowFlags & hint))

        QWidget.setWindowFlags(self, Qt_WindowFlags)

    @Slot()
    def on_btnMinimize_clicked(self):
        self.setWindowState(Qt.WindowMinimized)

    @Slot()
    def on_btnRestore_clicked(self):
        if self.btnMaximize.isEnabled() or self.btnRestore.isEnabled():
            self.btnRestore.setVisible(False)
            self.btnRestore.setEnabled(False)
            self.btnMaximize.setVisible(True)
            self.btnMaximize.setEnabled(True)

        self.setWindowState(Qt.WindowNoState)

    @Slot()
    def on_btnMaximize_clicked(self):
        if self.btnMaximize.isEnabled() or self.btnRestore.isEnabled():
            self.btnRestore.setVisible(True)
            self.btnRestore.setEnabled(True)
            self.btnMaximize.setVisible(False)
            self.btnMaximize.setEnabled(False)

        self.setWindowState(Qt.WindowMaximized)

    @Slot()
    def on_btnClose_clicked(self):
        self.close()

    @Slot()
    def on_titleBar_doubleClicked(self):
        if not bool(self.windowState() & Qt.WindowMaximized):
            self.on_btnMaximize_clicked()
        else:
            self.on_btnRestore_clicked()
Exemple #26
0
class Widget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.items = 0

        # Example data
        self._data = {
            "Water": 24.5,
            "Electricity": 55.1,
            "Rent": 850.0,
            "Supermarket": 230.4,
            "Internet": 29.99,
            "Spätkauf": 21.85,
            "BVG Ticket": 60.0,
            "Coffee": 22.45,
            "Meetup": 0.0
        }

        # Left
        self.table = QTableWidget()
        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(["Description", "Quantity"])
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # Right
        self.description = QLineEdit()
        self.quantity = QLineEdit()
        self.add = QPushButton("Add")
        self.clear = QPushButton("Clear")
        self.quit = QPushButton("Quit")

        self.right = QVBoxLayout()
        self.right.setContentsMargins(10, 10, 10, 10)
        self.right.addWidget(QLabel("Description"))
        self.right.addWidget(self.description)
        self.right.addWidget(QLabel("Quantity"))
        self.right.addWidget(self.quantity)
        self.right.addWidget(self.add)
        self.right.addStretch()
        self.right.addWidget(self.clear)
        self.right.addWidget(self.quit)

        # QWidget Layout
        self.layout = QHBoxLayout()

        self.layout.addWidget(self.table)
        self.layout.addLayout(self.right)

        # Set the layout to the QWidget
        self.setLayout(self.layout)

        # Fill example data
        self.fill_table()

    def fill_table(self, data=None):
        data = self._data if not data else data
        for desc, price in data.items():
            self.table.insertRow(self.items)
            self.table.setItem(self.items, 0, QTableWidgetItem(desc))
            self.table.setItem(self.items, 1, QTableWidgetItem(str(price)))
            self.items += 1
Exemple #27
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(450, 520)
        MainWindow.setMinimumSize(QSize(450, 520))
        MainWindow.setMaximumSize(QSize(450, 520))
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.bg_frame_2 = QVBoxLayout(self.centralwidget)
        self.bg_frame_2.setSpacing(0)
        self.bg_frame_2.setObjectName(u"bg_frame_2")
        self.bg_frame_2.setContentsMargins(10, 10, 10, 10)
        self.bg_frame = QFrame(self.centralwidget)
        self.bg_frame.setObjectName(u"bg_frame")
        self.bg_frame.setStyleSheet(u"background-color: rgb(29, 0, 86);\n"
                                    "border-radius: 10px;")
        self.bg_frame.setFrameShape(QFrame.NoFrame)
        self.bg_frame.setFrameShadow(QFrame.Raised)
        self.tittle_bar = QFrame(self.bg_frame)
        self.tittle_bar.setObjectName(u"tittle_bar")
        self.tittle_bar.setGeometry(QRect(10, 10, 411, 31))
        self.tittle_bar.setFrameShape(QFrame.StyledPanel)
        self.tittle_bar.setFrameShadow(QFrame.Raised)
        self.label = QLabel(self.tittle_bar)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(10, 0, 61, 31))
        self.label.setStyleSheet(u"color: rgb(255, 255, 255);\n"
                                 "font: 18pt \"Segoe UI\";")
        self.button_close = QPushButton(self.tittle_bar)
        self.button_close.setObjectName(u"button_close")
        self.button_close.setGeometry(QRect(380, 0, 21, 24))
        self.button_close.setStyleSheet(u"background-color: rgb(152, 0, 0);\n"
                                        "font: 14pt \"Segoe UI\";")
        self.button_minimize = QPushButton(self.tittle_bar)
        self.button_minimize.setObjectName(u"button_minimize")
        self.button_minimize.setGeometry(QRect(350, 0, 21, 24))
        self.button_minimize.setStyleSheet(
            u"background-color: rgb(53, 159, 159);\n"
            "font: 14pt \"Segoe UI\";")
        self.user_login = QLineEdit(self.bg_frame)
        self.user_login.setObjectName(u"user_login")
        self.user_login.setGeometry(QRect(60, 160, 301, 51))
        self.user_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n"
                                      "")
        self.pass_login = QLineEdit(self.bg_frame)
        self.pass_login.setObjectName(u"pass_login")
        self.pass_login.setGeometry(QRect(60, 281, 301, 51))
        self.pass_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n"
                                      "")
        self.user_lbl = QLabel(self.bg_frame)
        self.user_lbl.setObjectName(u"user_lbl")
        self.user_lbl.setGeometry(QRect(170, 110, 81, 41))
        self.user_lbl.setStyleSheet(u"color: rgb(255, 255, 255);\n"
                                    "font: 18pt \"Segoe UI\";")
        self.senha_lbl = QLabel(self.bg_frame)
        self.senha_lbl.setObjectName(u"senha_lbl")
        self.senha_lbl.setGeometry(QRect(179, 230, 71, 41))
        self.senha_lbl.setStyleSheet(u"color: rgb(255, 255, 255);\n"
                                     "font: 18pt \"Segoe UI\";")
        self.btn_login = QPushButton(self.bg_frame)
        self.btn_login.setObjectName(u"btn_login")
        self.btn_login.setGeometry(QRect(160, 360, 101, 41))
        self.btn_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n"
                                     "color: rgb(255, 255, 255);\n"
                                     "font: 18pt \"Segoe UI\";\n"
                                     "")

        self.bg_frame_2.addWidget(self.bg_frame)

        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)

    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            QCoreApplication.translate("MainWindow", u"Login", None))
        self.label.setText(
            QCoreApplication.translate("MainWindow", u"Login", None))
        self.button_close.setText(
            QCoreApplication.translate("MainWindow", u"x", None))
        self.button_minimize.setText(
            QCoreApplication.translate("MainWindow", u"-", None))
        self.user_lbl.setText(
            QCoreApplication.translate("MainWindow", u"Usu\u00e1rio", None))
        self.senha_lbl.setText(
            QCoreApplication.translate("MainWindow", u"Senha", None))
        self.btn_login.setText(
            QCoreApplication.translate("MainWindow", u"Logar", None))
Exemple #28
0
class Ui_demoView(object):
    def setupUi(self, demoView):
        if not demoView.objectName():
            demoView.setObjectName(u"demoView")
        demoView.resize(570, 550)
        self.verticalLayout_2 = QVBoxLayout(demoView)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.demoViewGroupBox = QGroupBox(demoView)
        self.demoViewGroupBox.setObjectName(u"demoViewGroupBox")
        self.demoViewGroupBox.setFlat(True)
        self.verticalLayout_6 = QVBoxLayout(self.demoViewGroupBox)
        self.verticalLayout_6.setObjectName(u"verticalLayout_6")
        self.verticalLayout_6.setContentsMargins(4, 4, 4, 4)
        self.demoTreeView = QTreeWidget(self.demoViewGroupBox)
        __qtreewidgetitem = QTreeWidgetItem()
        __qtreewidgetitem.setText(0, u"Step")
        self.demoTreeView.setHeaderItem(__qtreewidgetitem)
        self.demoTreeView.setObjectName(u"demoTreeView")

        self.verticalLayout_6.addWidget(self.demoTreeView)

        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
        self.demoDuplicateBtn = QPushButton(self.demoViewGroupBox)
        self.demoDuplicateBtn.setObjectName(u"demoDuplicateBtn")

        self.horizontalLayout_5.addWidget(self.demoDuplicateBtn)

        self.demoInsertSectionBtn = QPushButton(self.demoViewGroupBox)
        self.demoInsertSectionBtn.setObjectName(u"demoInsertSectionBtn")

        self.horizontalLayout_5.addWidget(self.demoInsertSectionBtn)

        self.demoDeleteBtn = QPushButton(self.demoViewGroupBox)
        self.demoDeleteBtn.setObjectName(u"demoDeleteBtn")

        self.horizontalLayout_5.addWidget(self.demoDeleteBtn)

        self.demoAddStepBtn = QPushButton(self.demoViewGroupBox)
        self.demoAddStepBtn.setObjectName(u"demoAddStepBtn")

        self.horizontalLayout_5.addWidget(self.demoAddStepBtn)

        self.demoOverflowBtn = QToolButton(self.demoViewGroupBox)
        self.demoOverflowBtn.setObjectName(u"demoOverflowBtn")

        self.horizontalLayout_5.addWidget(self.demoOverflowBtn)

        self.verticalLayout_6.addLayout(self.horizontalLayout_5)

        self.verticalLayout_2.addWidget(self.demoViewGroupBox)

        self.metadataGroupBox = QGroupBox(demoView)
        self.metadataGroupBox.setObjectName(u"metadataGroupBox")
        self.metadataGroupBox.setMaximumSize(QSize(16777215, 300))
        self.metadataGroupBox.setFlat(True)
        self.metadataGroupBox.setCheckable(False)
        self.verticalLayout_8 = QVBoxLayout(self.metadataGroupBox)
        self.verticalLayout_8.setObjectName(u"verticalLayout_8")
        self.verticalLayout_8.setContentsMargins(4, 4, 4, 4)
        self.dataStack = QStackedWidget(self.metadataGroupBox)
        self.dataStack.setObjectName(u"dataStack")
        self.stepDataL = QWidget()
        self.stepDataL.setObjectName(u"stepDataL")
        self.verticalLayout_14 = QVBoxLayout(self.stepDataL)
        self.verticalLayout_14.setObjectName(u"verticalLayout_14")
        self.metadataTreeWidget = QTreeWidget(self.stepDataL)
        self.metadataTreeWidget.setObjectName(u"metadataTreeWidget")

        self.verticalLayout_14.addWidget(self.metadataTreeWidget)

        self.stepDataBtnL = QHBoxLayout()
        self.stepDataBtnL.setObjectName(u"stepDataBtnL")
        self.pushButton_2 = QPushButton(self.stepDataL)
        self.pushButton_2.setObjectName(u"pushButton_2")

        self.stepDataBtnL.addWidget(self.pushButton_2)

        self.pushButton = QPushButton(self.stepDataL)
        self.pushButton.setObjectName(u"pushButton")

        self.stepDataBtnL.addWidget(self.pushButton)

        self.toolButton = QToolButton(self.stepDataL)
        self.toolButton.setObjectName(u"toolButton")

        self.stepDataBtnL.addWidget(self.toolButton)

        self.verticalLayout_14.addLayout(self.stepDataBtnL)

        self.dataStack.addWidget(self.stepDataL)
        self.sectDataL = QWidget()
        self.sectDataL.setObjectName(u"sectDataL")
        self.verticalLayout_16 = QVBoxLayout(self.sectDataL)
        self.verticalLayout_16.setObjectName(u"verticalLayout_16")
        self.sectionDataTreeW = QTreeWidget(self.sectDataL)
        self.sectionDataTreeW.setObjectName(u"sectionDataTreeW")

        self.verticalLayout_16.addWidget(self.sectionDataTreeW)

        self.sectionDataBtnL = QHBoxLayout()
        self.sectionDataBtnL.setObjectName(u"sectionDataBtnL")
        self.pushButton_4 = QPushButton(self.sectDataL)
        self.pushButton_4.setObjectName(u"pushButton_4")

        self.sectionDataBtnL.addWidget(self.pushButton_4)

        self.pushButton_3 = QPushButton(self.sectDataL)
        self.pushButton_3.setObjectName(u"pushButton_3")

        self.sectionDataBtnL.addWidget(self.pushButton_3)

        self.pushButton_5 = QPushButton(self.sectDataL)
        self.pushButton_5.setObjectName(u"pushButton_5")

        self.sectionDataBtnL.addWidget(self.pushButton_5)

        self.toolButton_2 = QToolButton(self.sectDataL)
        self.toolButton_2.setObjectName(u"toolButton_2")

        self.sectionDataBtnL.addWidget(self.toolButton_2)

        self.verticalLayout_16.addLayout(self.sectionDataBtnL)

        self.dataStack.addWidget(self.sectDataL)

        self.verticalLayout_8.addWidget(self.dataStack)

        self.verticalLayout_2.addWidget(self.metadataGroupBox)

        self.retranslateUi(demoView)

        self.dataStack.setCurrentIndex(1)

        QMetaObject.connectSlotsByName(demoView)

    # setupUi

    def retranslateUi(self, demoView):
        demoView.setWindowTitle(
            QCoreApplication.translate("demoView", u"Form", None))
        self.demoViewGroupBox.setTitle(
            QCoreApplication.translate("demoView", u"Demo (None loaded)",
                                       None))
        ___qtreewidgetitem = self.demoTreeView.headerItem()
        ___qtreewidgetitem.setText(
            2, QCoreApplication.translate("demoView", u"CI", None))
        ___qtreewidgetitem.setText(
            1, QCoreApplication.translate("demoView", u"TP", None))
        self.demoDuplicateBtn.setText(
            QCoreApplication.translate("demoView", u"Duplicate", None))
        self.demoInsertSectionBtn.setText(
            QCoreApplication.translate("demoView", u"Insert section", None))
        self.demoDeleteBtn.setText(
            QCoreApplication.translate("demoView", u"-", None))
        self.demoAddStepBtn.setText(
            QCoreApplication.translate("demoView", u"+", None))
        self.demoOverflowBtn.setText(
            QCoreApplication.translate("demoView", u"...", None))
        self.metadataGroupBox.setTitle(
            QCoreApplication.translate("demoView", u"Metadata", None))
        ___qtreewidgetitem1 = self.metadataTreeWidget.headerItem()
        ___qtreewidgetitem1.setText(
            1, QCoreApplication.translate("demoView", u"Value", None))
        ___qtreewidgetitem1.setText(
            0, QCoreApplication.translate("demoView", u"Property", None))
        self.pushButton_2.setText(
            QCoreApplication.translate("demoView", u"Set animated", None))
        self.pushButton.setText(
            QCoreApplication.translate("demoView", u"Add highlight", None))
        self.toolButton.setText(
            QCoreApplication.translate("demoView", u"...", None))
        ___qtreewidgetitem2 = self.sectionDataTreeW.headerItem()
        ___qtreewidgetitem2.setText(
            1, QCoreApplication.translate("demoView", u"Value", None))
        ___qtreewidgetitem2.setText(
            0, QCoreApplication.translate("demoView", u"Property", None))
        self.pushButton_4.setText(
            QCoreApplication.translate("demoView", u"Set Animated", None))
        self.pushButton_3.setText(
            QCoreApplication.translate("demoView", u"Set Guided", None))
        self.pushButton_5.setText(
            QCoreApplication.translate("demoView", u"Set Scroll", None))
        self.toolButton_2.setText(
            QCoreApplication.translate("demoView", u"...", None))
class Widget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.items = 0

        # Left
        self.table = QTableWidget()
        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(["Description", "Quantity"])
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # Chart
        self.chart_view = QChartView()
        self.chart_view.setRenderHint(QPainter.Antialiasing)

        # Right
        self.description = QLineEdit()
        self.quantity = QLineEdit()
        self.add = QPushButton("Add")
        self.clear = QPushButton("Clear")
        self.quit = QPushButton("Quit")
        self.plot = QPushButton("Plot")

        # Disabling 'Add' button
        self.add.setEnabled(False)

        self.right = QVBoxLayout()
        self.right.setContentsMargins(10, 10, 10, 10)

        self.right_top = QGridLayout()

        self.right_top.addWidget(QLabel("Description"), 0, 0, 1, 1)
        self.right_top.addWidget(self.description, 0, 1, 1, 3)
        self.right_top.addWidget(QLabel("Quantity"), 1, 0, 1, 1)
        self.right_top.addWidget(self.quantity, 1, 1, 1, 1)
        self.right_top.addWidget(self.add, 1, 2, 1, 2)

        self.right.addLayout(self.right_top)
        self.right.addWidget(self.chart_view)

        self.right_bottom = QGridLayout()
        self.right_bottom.addWidget(self.plot, 0, 0, 1, 2)
        self.right_bottom.addWidget(self.clear, 1, 0)
        self.right_bottom.addWidget(self.quit, 1, 1)

        self.right.addLayout(self.right_bottom)

        # QWidget Layout
        self.layout = QHBoxLayout()

        self.layout.addWidget(self.table)
        self.layout.addLayout(self.right)

        # Set the layout to the QWidget
        self.setLayout(self.layout)

        # Signals and Slots
        self.add.clicked.connect(self.add_element)
        self.quit.clicked.connect(self.quit_application)
        self.plot.clicked.connect(self.plot_data)
        self.clear.clicked.connect(self.clear_table)
        self.description.textChanged[str].connect(self.check_disable)
        self.quantity.textChanged[str].connect(self.check_disable)

    @Slot()
    def add_element(self):
        des = self.description.text()
        qty = self.quantity.text()

        self.table.insertRow(self.items)
        self.table.setItem(self.items, 0, QTableWidgetItem(des))
        self.table.setItem(self.items, 1, QTableWidgetItem(qty))

        self.description.setText("")
        self.quantity.setText("")

        self.items += 1

    @Slot()
    def check_disable(self, s):
        if not self.description.text() or not self.quantity.text():
            self.add.setEnabled(False)
        else:
            self.add.setEnabled(True)

    @Slot()
    def plot_data(self):
        # Get table information
        series = QBarSeries()
        for i in range(self.table.rowCount()):
            text = self.table.item(i, 0).text()
            number = float(self.table.item(i, 1).text())

            bar_set = QBarSet(text)
            bar_set.append(number)

            series.append(bar_set)

        chart = QChart()
        chart.addSeries(series)
        chart.legend().setAlignment(Qt.AlignLeft)
        self.chart_view.setChart(chart)

    @Slot()
    def quit_application(self):
        QApplication.quit()

    @Slot()
    def clear_table(self):
        self.table.setRowCount(0)
        self.items = 0
Exemple #30
0
    def __init__(self, persepolis_setting):
        super().__init__()
        # MainWindow
        self.persepolis_setting = persepolis_setting

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        icons = ':/' + \
            str(self.persepolis_setting.value('settings/icons')) + '/'

        self.setWindowTitle(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "Persepolis Download Manager"))
        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))

        self.centralwidget = QWidget(self)
        self.verticalLayout = QVBoxLayout(self.centralwidget)

        # enable drag and drop
        self.setAcceptDrops(True)

        # frame
        self.frame = QFrame(self.centralwidget)

        # download_table_horizontalLayout
        download_table_horizontalLayout = QHBoxLayout()
        horizontal_splitter = QSplitter(Qt.Horizontal)

        vertical_splitter = QSplitter(Qt.Vertical)

        # category_tree
        self.category_tree_qwidget = QWidget(self)
        category_tree_verticalLayout = QVBoxLayout()
        self.category_tree = CategoryTreeView(self)
        category_tree_verticalLayout.addWidget(self.category_tree)

        self.category_tree_model = QStandardItemModel()
        self.category_tree.setModel(self.category_tree_model)
        category_table_header = [
            QCoreApplication.translate("mainwindow_ui_tr", 'Category')
        ]

        self.category_tree_model.setHorizontalHeaderLabels(
            category_table_header)
        self.category_tree.header().setStretchLastSection(True)

        self.category_tree.header().setDefaultAlignment(Qt.AlignCenter)

        # queue_panel
        self.queue_panel_widget = QWidget(self)

        queue_panel_verticalLayout_main = QVBoxLayout(self.queue_panel_widget)

        # queue_panel_show_button
        self.queue_panel_show_button = QPushButton(self)

        queue_panel_verticalLayout_main.addWidget(self.queue_panel_show_button)

        # queue_panel_widget_frame
        self.queue_panel_widget_frame = QFrame(self)
        self.queue_panel_widget_frame.setFrameShape(QFrame.StyledPanel)
        self.queue_panel_widget_frame.setFrameShadow(QFrame.Raised)

        queue_panel_verticalLayout_main.addWidget(
            self.queue_panel_widget_frame)

        queue_panel_verticalLayout = QVBoxLayout(self.queue_panel_widget_frame)
        queue_panel_verticalLayout_main.setContentsMargins(50, -1, 50, -1)

        # start_end_frame
        self.start_end_frame = QFrame(self)

        # start time
        start_verticalLayout = QVBoxLayout(self.start_end_frame)
        self.start_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.start_checkBox)

        self.start_frame = QFrame(self)
        self.start_frame.setFrameShape(QFrame.StyledPanel)
        self.start_frame.setFrameShadow(QFrame.Raised)

        start_frame_verticalLayout = QVBoxLayout(self.start_frame)

        self.start_time_qDataTimeEdit = MyQDateTimeEdit(self.start_frame)
        self.start_time_qDataTimeEdit.setDisplayFormat('H:mm')
        start_frame_verticalLayout.addWidget(self.start_time_qDataTimeEdit)

        start_verticalLayout.addWidget(self.start_frame)

        # end time
        self.end_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.end_checkBox)

        self.end_frame = QFrame(self)
        self.end_frame.setFrameShape(QFrame.StyledPanel)
        self.end_frame.setFrameShadow(QFrame.Raised)

        end_frame_verticalLayout = QVBoxLayout(self.end_frame)

        self.end_time_qDateTimeEdit = MyQDateTimeEdit(self.end_frame)
        self.end_time_qDateTimeEdit.setDisplayFormat('H:mm')
        end_frame_verticalLayout.addWidget(self.end_time_qDateTimeEdit)

        start_verticalLayout.addWidget(self.end_frame)

        self.reverse_checkBox = QCheckBox(self)
        start_verticalLayout.addWidget(self.reverse_checkBox)

        queue_panel_verticalLayout.addWidget(self.start_end_frame)

        # limit_after_frame
        self.limit_after_frame = QFrame(self)

        # limit_checkBox
        limit_verticalLayout = QVBoxLayout(self.limit_after_frame)
        self.limit_checkBox = QCheckBox(self)
        limit_verticalLayout.addWidget(self.limit_checkBox)

        # limit_frame
        self.limit_frame = QFrame(self)
        self.limit_frame.setFrameShape(QFrame.StyledPanel)
        self.limit_frame.setFrameShadow(QFrame.Raised)
        limit_verticalLayout.addWidget(self.limit_frame)

        limit_frame_verticalLayout = QVBoxLayout(self.limit_frame)

        # limit_spinBox
        limit_frame_horizontalLayout = QHBoxLayout()
        self.limit_spinBox = QDoubleSpinBox(self)
        self.limit_spinBox.setMinimum(1)
        self.limit_spinBox.setMaximum(1023)
        limit_frame_horizontalLayout.addWidget(self.limit_spinBox)

        # limit_comboBox
        self.limit_comboBox = QComboBox(self)
        self.limit_comboBox.addItem("")
        self.limit_comboBox.addItem("")
        limit_frame_horizontalLayout.addWidget(self.limit_comboBox)
        limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout)

        # limit_pushButton
        self.limit_pushButton = QPushButton(self)
        limit_frame_verticalLayout.addWidget(self.limit_pushButton)

        # after_checkBox
        self.after_checkBox = QCheckBox(self)
        limit_verticalLayout.addWidget(self.after_checkBox)

        # after_frame
        self.after_frame = QFrame(self)
        self.after_frame.setFrameShape(QFrame.StyledPanel)
        self.after_frame.setFrameShadow(QFrame.Raised)
        limit_verticalLayout.addWidget(self.after_frame)

        after_frame_verticalLayout = QVBoxLayout(self.after_frame)

        # after_comboBox
        self.after_comboBox = QComboBox(self)
        self.after_comboBox.addItem("")

        after_frame_verticalLayout.addWidget(self.after_comboBox)

        # after_pushButton
        self.after_pushButton = QPushButton(self)
        after_frame_verticalLayout.addWidget(self.after_pushButton)

        queue_panel_verticalLayout.addWidget(self.limit_after_frame)
        category_tree_verticalLayout.addWidget(self.queue_panel_widget)

        # keep_awake_checkBox
        self.keep_awake_checkBox = QCheckBox(self)
        queue_panel_verticalLayout.addWidget(self.keep_awake_checkBox)

        self.category_tree_qwidget.setLayout(category_tree_verticalLayout)
        horizontal_splitter.addWidget(self.category_tree_qwidget)

        # download table widget
        self.download_table_content_widget = QWidget(self)
        download_table_content_widget_verticalLayout = QVBoxLayout(
            self.download_table_content_widget)

        # download_table
        self.download_table = DownloadTableWidget(self)
        vertical_splitter.addWidget(self.download_table)

        horizontal_splitter.addWidget(self.download_table_content_widget)

        self.download_table.setColumnCount(13)
        self.download_table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.download_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.download_table.verticalHeader().hide()

        # hide column of GID and column of link.
        self.download_table.setColumnHidden(8, True)
        self.download_table.setColumnHidden(9, True)

        download_table_header = [
            QCoreApplication.translate("mainwindow_ui_tr", 'File Name'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Status'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Size'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Downloaded'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Percentage'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Connections'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Transfer Rate'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Estimated Time Left'), 'Gid',
            QCoreApplication.translate("mainwindow_ui_tr", 'Link'),
            QCoreApplication.translate("mainwindow_ui_tr", 'First Try Date'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Last Try Date'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Category')
        ]

        self.download_table.setHorizontalHeaderLabels(download_table_header)

        # fixing the size of download_table when window is Maximized!
        self.download_table.horizontalHeader().setSectionResizeMode(
            QHeaderView.ResizeMode.Interactive)
        self.download_table.horizontalHeader().setStretchLastSection(True)

        horizontal_splitter.setStretchFactor(0, 3)  # category_tree width
        horizontal_splitter.setStretchFactor(1, 10)  # ratio of tables's width

        # video_finder_widget
        self.video_finder_widget = QWidget(self)
        video_finder_horizontalLayout = QHBoxLayout(self.video_finder_widget)

        self.muxing_pushButton = QPushButton(self)
        self.muxing_pushButton.setIcon(QIcon(icons + 'video_finder'))
        video_finder_horizontalLayout.addWidget(self.muxing_pushButton)
        video_finder_horizontalLayout.addSpacing(20)

        video_audio_verticalLayout = QVBoxLayout()

        self.video_label = QLabel(self)
        video_audio_verticalLayout.addWidget(self.video_label)

        self.audio_label = QLabel(self)
        video_audio_verticalLayout.addWidget(self.audio_label)
        video_finder_horizontalLayout.addLayout(video_audio_verticalLayout)

        status_muxing_verticalLayout = QVBoxLayout()

        self.video_finder_status_label = QLabel(self)
        status_muxing_verticalLayout.addWidget(self.video_finder_status_label)

        self.muxing_status_label = QLabel(self)
        status_muxing_verticalLayout.addWidget(self.muxing_status_label)
        video_finder_horizontalLayout.addLayout(status_muxing_verticalLayout)

        vertical_splitter.addWidget(self.video_finder_widget)

        download_table_content_widget_verticalLayout.addWidget(
            vertical_splitter)

        download_table_horizontalLayout.addWidget(horizontal_splitter)

        self.frame.setLayout(download_table_horizontalLayout)

        self.verticalLayout.addWidget(self.frame)

        self.setCentralWidget(self.centralwidget)

        # menubar
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 600, 24))
        self.setMenuBar(self.menubar)
        fileMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&File'))
        editMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&Edit'))
        viewMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&View'))
        downloadMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&Download'))
        queueMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&Queue'))
        videoFinderMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", 'V&ideo Finder'))
        helpMenu = self.menubar.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", '&Help'))

        # viewMenu submenus
        sortMenu = viewMenu.addMenu(
            QCoreApplication.translate("mainwindow_ui_tr", 'Sort by'))

        # statusbar
        self.statusbar = QStatusBar(self)
        self.setStatusBar(self.statusbar)
        self.statusbar.showMessage(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "Persepolis Download Manager"))

        # toolBar
        self.toolBar2 = QToolBar(self)
        self.addToolBar(Qt.TopToolBarArea, self.toolBar2)
        self.toolBar2.setWindowTitle(
            QCoreApplication.translate("mainwindow_ui_tr", 'Menu'))
        self.toolBar2.setFloatable(False)
        self.toolBar2.setMovable(False)

        self.toolBar = QToolBar(self)
        self.addToolBar(Qt.TopToolBarArea, self.toolBar)
        self.toolBar.setWindowTitle(
            QCoreApplication.translate("mainwindow_ui_tr", 'Toolbar'))
        self.toolBar.setFloatable(False)
        self.toolBar.setMovable(False)

        #toolBar and menubar and actions
        self.persepolis_setting.beginGroup('settings/shortcuts')

        # videoFinderAddLinkAction
        self.videoFinderAddLinkAction = QAction(
            QIcon(icons + 'video_finder'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Find Video Links...'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Download video or audio from Youtube, Vimeo, etc.'),
            triggered=self.showVideoFinderAddLinkWindow)

        self.videoFinderAddLinkAction_shortcut = QShortcut(
            self.persepolis_setting.value('video_finder_shortcut'), self,
            self.showVideoFinderAddLinkWindow)

        videoFinderMenu.addAction(self.videoFinderAddLinkAction)

        # stopAllAction
        self.stopAllAction = QAction(QIcon(icons + 'stop_all'),
                                     QCoreApplication.translate(
                                         "mainwindow_ui_tr",
                                         'Stop All Active Downloads'),
                                     self,
                                     statusTip='Stop All Active Downloads',
                                     triggered=self.stopAllDownloads)
        downloadMenu.addAction(self.stopAllAction)

        # sort_file_name_Action
        self.sort_file_name_Action = QAction(QCoreApplication.translate(
            "mainwindow_ui_tr", 'File Name'),
                                             self,
                                             triggered=self.sortByName)
        sortMenu.addAction(self.sort_file_name_Action)

        # sort_file_size_Action
        self.sort_file_size_Action = QAction(QCoreApplication.translate(
            "mainwindow_ui_tr", 'File Size'),
                                             self,
                                             triggered=self.sortBySize)
        sortMenu.addAction(self.sort_file_size_Action)

        # sort_first_try_date_Action
        self.sort_first_try_date_Action = QAction(
            QCoreApplication.translate("mainwindow_ui_tr", 'First Try Date'),
            self,
            triggered=self.sortByFirstTry)
        sortMenu.addAction(self.sort_first_try_date_Action)

        # sort_last_try_date_Action
        self.sort_last_try_date_Action = QAction(QCoreApplication.translate(
            "mainwindow_ui_tr", 'Last Try Date'),
                                                 self,
                                                 triggered=self.sortByLastTry)
        sortMenu.addAction(self.sort_last_try_date_Action)

        # sort_download_status_Action
        self.sort_download_status_Action = QAction(QCoreApplication.translate(
            "mainwindow_ui_tr", 'Download Status'),
                                                   self,
                                                   triggered=self.sortByStatus)
        sortMenu.addAction(self.sort_download_status_Action)

        # trayAction
        self.trayAction = QAction(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Show System Tray Icon'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Show/Hide system tray icon"),
            triggered=self.showTray)
        self.trayAction.setCheckable(True)
        viewMenu.addAction(self.trayAction)

        # showMenuBarAction
        self.showMenuBarAction = QAction(
            QCoreApplication.translate("mainwindow_ui_tr", 'Show Menubar'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Show Menubar'),
            triggered=self.showMenuBar)
        self.showMenuBarAction.setCheckable(True)
        viewMenu.addAction(self.showMenuBarAction)

        # showSidePanelAction
        self.showSidePanelAction = QAction(
            QCoreApplication.translate("mainwindow_ui_tr", 'Show Side Panel'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Show Side Panel'),
            triggered=self.showSidePanel)
        self.showSidePanelAction.setCheckable(True)
        viewMenu.addAction(self.showSidePanelAction)

        # minimizeAction
        self.minimizeAction = QAction(
            QIcon(icons + 'minimize'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Minimize to System Tray'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Minimize to System Tray"),
            triggered=self.minMaxTray)

        self.minimizeAction_shortcut = QShortcut(
            self.persepolis_setting.value('hide_window_shortcut'), self,
            self.minMaxTray)
        viewMenu.addAction(self.minimizeAction)

        # addlinkAction
        self.addlinkAction = QAction(
            QIcon(icons + 'add'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Add New Download Link...'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Add New Download Link"),
            triggered=self.addLinkButtonPressed)

        self.addlinkAction_shortcut = QShortcut(
            self.persepolis_setting.value('add_new_download_shortcut'), self,
            self.addLinkButtonPressed)
        fileMenu.addAction(self.addlinkAction)

        # importText
        self.addtextfileAction = QAction(
            QIcon(icons + 'file'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Import Links from Text File...'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Create a text file and put links in it, line by line!'),
            triggered=self.importText)

        self.addtextfileAction_shortcut = QShortcut(
            self.persepolis_setting.value('import_text_shortcut'), self,
            self.importText)

        fileMenu.addAction(self.addtextfileAction)

        # resumeAction
        self.resumeAction = QAction(
            QIcon(icons + 'play'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Resume Download'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Resume Download"),
            triggered=self.resumeButtonPressed)

        downloadMenu.addAction(self.resumeAction)

        # pauseAction
        self.pauseAction = QAction(
            QIcon(icons + 'pause'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Pause Download'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Pause Download"),
            triggered=self.pauseButtonPressed)

        downloadMenu.addAction(self.pauseAction)

        # stopAction
        self.stopAction = QAction(
            QIcon(icons + 'stop'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Stop Download'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Stop/Cancel Download"),
            triggered=self.stopButtonPressed)

        downloadMenu.addAction(self.stopAction)

        # propertiesAction
        self.propertiesAction = QAction(
            QIcon(icons + 'setting'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Properties'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Properties"),
            triggered=self.propertiesButtonPressed)

        downloadMenu.addAction(self.propertiesAction)

        # progressAction
        self.progressAction = QAction(
            QIcon(icons + 'window'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Progress'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 "Progress"),
            triggered=self.progressButtonPressed)

        downloadMenu.addAction(self.progressAction)

        # openFileAction
        self.openFileAction = QAction(
            QIcon(icons + 'file'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Open File...'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Open File...'),
            triggered=self.openFile)
        fileMenu.addAction(self.openFileAction)

        # openDownloadFolderAction
        self.openDownloadFolderAction = QAction(
            QIcon(icons + 'folder'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Open Download Folder'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Open Download Folder'),
            triggered=self.openDownloadFolder)

        fileMenu.addAction(self.openDownloadFolderAction)

        # openDefaultDownloadFolderAction
        self.openDefaultDownloadFolderAction = QAction(
            QIcon(icons + 'folder'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Open Default Download Folder'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr", 'Open Default Download Folder'),
            triggered=self.openDefaultDownloadFolder)

        fileMenu.addAction(self.openDefaultDownloadFolderAction)

        # exitAction
        self.exitAction = QAction(
            QIcon(icons + 'exit'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Exit'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr", "Exit"),
            triggered=self.closeAction)

        self.exitAction_shortcut = QShortcut(
            self.persepolis_setting.value('quit_shortcut'), self,
            self.closeAction)

        fileMenu.addAction(self.exitAction)

        # clearAction
        self.clearAction = QAction(QIcon(icons + 'multi_remove'),
                                   QCoreApplication.translate(
                                       "mainwindow_ui_tr",
                                       'Clear Download List'),
                                   self,
                                   statusTip=QCoreApplication.translate(
                                       "mainwindow_ui_tr",
                                       'Clear all items in download list'),
                                   triggered=self.clearDownloadList)
        editMenu.addAction(self.clearAction)

        # removeSelectedAction
        self.removeSelectedAction = QAction(
            QIcon(icons + 'remove'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Remove Selected Downloads from List'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr", 'Remove Selected Downloads from List'),
            triggered=self.removeSelected)

        self.removeSelectedAction_shortcut = QShortcut(
            self.persepolis_setting.value('remove_shortcut'), self,
            self.removeSelected)

        editMenu.addAction(self.removeSelectedAction)
        self.removeSelectedAction.setEnabled(False)

        # deleteSelectedAction
        self.deleteSelectedAction = QAction(
            QIcon(icons + 'trash'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Delete Selected Download Files'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr", 'Delete Selected Download Files'),
            triggered=self.deleteSelected)

        self.deleteSelectedAction_shortcut = QShortcut(
            self.persepolis_setting.value('delete_shortcut'), self,
            self.deleteSelected)

        editMenu.addAction(self.deleteSelectedAction)
        self.deleteSelectedAction.setEnabled(False)

        # moveSelectedDownloadsAction
        self.moveSelectedDownloadsAction = QAction(
            QIcon(icons + 'folder'),
            QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Move Selected Download Files to Another Folder...'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Move Selected Download Files to Another Folder'),
            triggered=self.moveSelectedDownloads)

        editMenu.addAction(self.moveSelectedDownloadsAction)
        self.moveSelectedDownloadsAction.setEnabled(False)

        # createQueueAction
        self.createQueueAction = QAction(
            QIcon(icons + 'add_queue'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Create New Queue...'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Create new download queue'),
            triggered=self.createQueue)
        queueMenu.addAction(self.createQueueAction)

        # removeQueueAction
        self.removeQueueAction = QAction(
            QIcon(icons + 'remove_queue'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Remove Queue'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Remove this queue'),
            triggered=self.removeQueue)
        queueMenu.addAction(self.removeQueueAction)

        # startQueueAction
        self.startQueueAction = QAction(
            QIcon(icons + 'start_queue'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Start this queue'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Start Queue'),
            triggered=self.startQueue)

        queueMenu.addAction(self.startQueueAction)

        # stopQueueAction
        self.stopQueueAction = QAction(
            QIcon(icons + 'stop_queue'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Stop this queue'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Stop Queue'),
            triggered=self.stopQueue)

        queueMenu.addAction(self.stopQueueAction)

        # moveUpSelectedAction
        self.moveUpSelectedAction = QAction(
            QIcon(icons + 'multi_up'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Move Selected Items Up'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Move currently selected items up by one row'),
            triggered=self.moveUpSelected)

        self.moveUpSelectedAction_shortcut = QShortcut(
            self.persepolis_setting.value('move_up_selection_shortcut'), self,
            self.moveUpSelected)

        queueMenu.addAction(self.moveUpSelectedAction)

        # moveDownSelectedAction
        self.moveDownSelectedAction = QAction(
            QIcon(icons + 'multi_down'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Move Selected Items Down'),
            self,
            statusTip=QCoreApplication.translate(
                "mainwindow_ui_tr",
                'Move currently selected items down by one row'),
            triggered=self.moveDownSelected)
        self.moveDownSelectedAction_shortcut = QShortcut(
            self.persepolis_setting.value('move_down_selection_shortcut'),
            self, self.moveDownSelected)

        queueMenu.addAction(self.moveDownSelectedAction)

        # preferencesAction
        self.preferencesAction = QAction(
            QIcon(icons + 'preferences'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Preferences'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Preferences'),
            triggered=self.openPreferences,
            menuRole=QAction.MenuRole.PreferencesRole)
        editMenu.addAction(self.preferencesAction)

        # aboutAction
        self.aboutAction = QAction(
            QIcon(icons + 'about'),
            QCoreApplication.translate("mainwindow_ui_tr", 'About'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'About'),
            triggered=self.openAbout,
            menuRole=QAction.MenuRole.AboutRole)
        helpMenu.addAction(self.aboutAction)

        # issueAction
        self.issueAction = QAction(
            QIcon(icons + 'about'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Report an Issue'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Report an issue'),
            triggered=self.reportIssue)
        helpMenu.addAction(self.issueAction)

        # updateAction
        self.updateAction = QAction(
            QIcon(icons + 'about'),
            QCoreApplication.translate("mainwindow_ui_tr",
                                       'Check for Newer Version'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr",
                                                 'Check for newer release'),
            triggered=self.newUpdate)
        helpMenu.addAction(self.updateAction)

        # logAction
        self.logAction = QAction(
            QIcon(icons + 'about'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Show Log File'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Help'),
            triggered=self.showLog)
        helpMenu.addAction(self.logAction)

        # helpAction
        self.helpAction = QAction(
            QIcon(icons + 'about'),
            QCoreApplication.translate("mainwindow_ui_tr", 'Help'),
            self,
            statusTip=QCoreApplication.translate("mainwindow_ui_tr", 'Help'),
            triggered=self.persepolisHelp)
        helpMenu.addAction(self.helpAction)

        self.persepolis_setting.endGroup()

        self.qmenu = MenuWidget(self)

        self.toolBar2.addWidget(self.qmenu)

        # labels
        self.queue_panel_show_button.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Hide Options"))
        self.start_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Start Time"))

        self.end_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "End Time"))

        self.reverse_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "Download bottom of\n the list first"))

        self.limit_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Limit Speed"))
        self.limit_comboBox.setItemText(0, "KiB/s")
        self.limit_comboBox.setItemText(1, "MiB/s")
        self.limit_pushButton.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Apply"))

        self.after_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "After download"))
        self.after_comboBox.setItemText(
            0, QCoreApplication.translate("mainwindow_ui_tr", "Shut Down"))

        self.keep_awake_checkBox.setText(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "Keep System Awake!"))
        self.keep_awake_checkBox.setToolTip(
            QCoreApplication.translate(
                "mainwindow_ui_tr",
                "<html><head/><body><p>This option will prevent the system from going to sleep.\
            It is necessary if your power manager is suspending the system automatically. </p></body></html>"
            ))

        self.after_pushButton.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Apply"))

        self.muxing_pushButton.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "Start Mixing"))

        self.video_label.setText(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "<b>Video File Status: </b>"))
        self.audio_label.setText(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "<b>Audio File Status: </b>"))

        self.video_finder_status_label.setText(
            QCoreApplication.translate("mainwindow_ui_tr", "<b>Status: </b>"))
        self.muxing_status_label.setText(
            QCoreApplication.translate("mainwindow_ui_tr",
                                       "<b>Mixing status: </b>"))