Example #1
0
 def __init__(self, parent):
     """Init class"""
     super().__init__("Add Item Toolbar",
                      parent=parent)  # Inherits stylesheet from ToolboxUI
     label = QLabel("Add Item")
     self.addWidget(label)
     # DS
     data_store_pixmap = QPixmap(":/icons/ds_icon.png")
     data_store_widget = DraggableWidget(self, data_store_pixmap,
                                         "Data Store")
     data_store_action = self.addWidget(data_store_widget)
     # DC
     data_connection_pixmap = QPixmap(":/icons/dc_icon.png")
     data_connection_widget = DraggableWidget(self, data_connection_pixmap,
                                              "Data Connection")
     data_connection_action = self.addWidget(data_connection_widget)
     # Tool
     tool_pixmap = QPixmap(":/icons/tool_icon.png")
     tool_widget = DraggableWidget(self, tool_pixmap, "Tool")
     tool_action = self.addWidget(tool_widget)
     # View
     view_pixmap = QPixmap(":/icons/view_icon.png")
     view_widget = DraggableWidget(self, view_pixmap, "View")
     view_action = self.addWidget(view_widget)
     # set remove all action
     remove_all_icon = QIcon()
     remove_all_icon.addPixmap(QPixmap(":/icons/remove_all.png"),
                               QIcon.Normal, QIcon.On)
     remove_all = QAction(remove_all_icon, "Remove All", parent)
     remove_all.triggered.connect(parent.remove_all_items)
     self.addSeparator()
     self.addAction(remove_all)
     # Set stylesheet
     self.setStyleSheet(ICON_TOOLBAR_SS)
     self.setObjectName("ItemToolbar")
Example #2
0
    def setupUi(self, app):

        super(MainApp, self).setupUi(app)
        # Generar los planos donde graficaremos los datos
        # Inicializar base de ploteo para mainplot

        app.vbl_xy_plot = QVBoxLayout(app.w_plot_xy)
        app.xy_canvas = canvas(app.w_plot_xy)
        app.xy_canvas.setStyleSheet("background-color:transparent;")
        # jmc_prensa_daq.presure_tlb = NavigationToolbar(jmc_prensa_daq.presure_canvas,
        #                                      jmc_prensa_daq.plot_e_p)
        app.vbl_xy_plot.insertWidget(0, app.xy_canvas)
        # jmc_prensa_daq.vbl_presure_plot.insertWidget(1, jmc_prensa_daq.presure_tlb)

        app.vbl_freq_plot = QVBoxLayout(app.w_plot_freq)
        app.f_canvas = canvas(app.w_plot_freq)
        app.f_canvas.setStyleSheet("background-color:transparent;")
        app.vbl_freq_plot.insertWidget(0, app.f_canvas)

        app.vbl_aux_plot = QVBoxLayout(app.w_plot_aux)
        app.aux_canvas = canvas(app.w_plot_aux, double=True)
        app.aux_canvas.setStyleSheet("background-color:transparent;")
        app.vbl_aux_plot.insertWidget(0, app.aux_canvas)

        font = QFont()
        font.setFamily("Exo 2")
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        app.setFont(font)

        icon = QIcon()
        icon.addPixmap(QPixmap("gui/images/logo-symbol-64x64.png"),
                       QIcon.Normal, QIcon.Off)
        app.setWindowIcon(icon)
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QProgressDialog().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widget central.
        widget = QWidget()
        self.setCentralWidget(widget)

        # Widgets.
        vbox = QVBoxLayout()
        widget.setLayout(vbox)

        self.label = QLabel(
            'A janela de processo irá abrir sozinha quando o evento do'
            'timer (QTimer) for iniciado.\n'
            'Ao clicar no botão cancelar o evento é interrompido.\n'
            'Quando o diálogo de progresso atinge o maximo o envento é '
            'interrompido.', )
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        button = QPushButton('Abrir diálogo novamente')
        button.clicked.connect(self.start_progress_again)
        vbox.addWidget(button)

        self.progress_dialog = QProgressDialog(
            parent=self,
            labelText=(
                'Ao clicar em cancelar o timer (QTimer) será parado e a barra '
                'de progresso é reiniciada.'),
            cancelButtonText='Cancelar',
            minimum=0,
            maximum=100,
        )
        self.progress_dialog.setWindowTitle('Titulo da janela de diálogo')
        self.progress_dialog.setModal(True)
        self.progress_dialog.canceled.connect(self.stop_progress)

        self.timer = QTimer()
        self.timer.timeout.connect(self.start_progress)
        self.timer.start(1000)
    def __init__(self):
        super(MainWindow, self).__init__()
        # Título da janela.
        self.setWindowTitle('QVBoxLayout com QMainWindow.')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Layout.
        vbox = QVBoxLayout()

        # Widget central.
        widget = QWidget()
        widget.setLayout(vbox)
        self.setCentralWidget(widget)

        for n in range(1, 5):
            button = QPushButton(f'Button {n}')
            vbox.addWidget(button)
Example #5
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.date_view = QListView()
        self.forum_view = QListView()
        self.contentMax = 0
        self.ioloop = asyncio.get_event_loop()
        icon = QIcon()
        icon.addPixmap(QPixmap(FAVICON_ICO), QIcon.Normal)
        self.setWindowIcon(icon)
        self.setWindowTitle(APP_TITLE)

        self.settings = QSettings('karoStudio', 'nnm-stats')
        self.resize(self.settings.value('main/size', QSize(640, 480)))
        self.move(self.settings.value('main/pos', QPoint(200, 200)))

        self.splitter = QSplitter()
        self.get_menu()

        self.content = QScrollArea()
        self.content.verticalScrollBar().valueChanged.connect(
            self.scrollBarChanged)
        self.content.verticalScrollBar().rangeChanged.connect(
            self.rangeChanged)
        self.torrents_list_view = QWidget()
        layout = QGridLayout()
        self.torrents_list_view.setLayout(layout)
        self.content.setWidget(self.torrents_list_view)
        self.splitter.addWidget(self.content)
        self.splitter.setSizes([160, 350])
        self.setCentralWidget(self.splitter)

        self.timer = QTimer()
        self.timer.singleShot(1600, self.load_task)
    def __init__(self):
        super(MainWindow, self).__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QStatusBar().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Statusbar fica localizado na parte inferior da janela.
        statusbar = self.statusBar()
        statusbar.setStyleSheet('color: red')
        statusbar.showMessage('Texto que será exibido na barra de estatus.', 5000)
Example #7
0
    def __init__(self):
        super().__init__()
        screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(int(width / 2), int(height / 2))
        self.setMinimumSize(int(width / 2), int(height / 2))
        self.setWindowTitle('QMainWindow e connect')
        icon = QIcon()
        icon.addPixmap(QPixmap('../assets/icons/icon.png'))
        self.setWindowIcon(icon)

        vbox = QVBoxLayout()
        widget = QWidget()
        widget.setLayout(vbox)
        self.setCentralWidget(widget)

        self.label = QLabel(
            'Este texto será alterado quando o botão for clicado!')
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        self.line_edit = QLineEdit()
        self.line_edit.setPlaceholderText('Digite algo')
        vbox.addWidget(self.line_edit)

        push_button = QPushButton('Clique Aqui')
        push_button.clicked.connect(self.on_button_clicked)
        vbox.addWidget(push_button)
Example #8
0
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('QMainWindow.')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widget central.
        widget = QWidget()
        self.setCentralWidget(widget)
Example #9
0
    def __init__(self):
        super().__init__()
        # Resolução do monitor.
        screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        # Tamanho inicial da janela.
        self.resize(int(width / 2), int(height / 2))
        # Tamanho mínimo da janela.
        self.setMinimumSize(int(width / 3), int(height / 3))
        # Título da janela.
        self.setWindowTitle('PySide2 QToolBar()')
        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../assets/icons/icon.png'))
        self.setWindowIcon(icon)

        # Toolbar pode ser movido para diversas áreas da janela.
        tool_bar = QToolBar()
        tool_bar.setToolTip('Barra de ferramentas')
        self.addToolBar(tool_bar)

        icon_copy = QIcon('../../assets/icons/copy-64x64.png')
        tool_bar.addAction(icon_copy, 'Copiar',
                           self.action_copy).setToolTip('Copiar')

        icon_paste = QIcon('../../assets/icons/paste-64x64.png')
        tool_bar.addAction(icon_paste, 'Colar',
                           self.action_paste).setToolTip('Colar')
    def __init__(self):
        super(MainWindow, self).__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QMenuBar().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Menubar fica lozalizado na parte superior da janela.
        menu_bar = self.menuBar()

        menu_file = menu_bar.addMenu('Arquivo')
        menu_file.addAction('Sair 1', self.close_app)

        icon_exit = QIcon('../../../images/icons/exit-64x64.png')
        menu_file.addAction(icon_exit, 'Sair 2', self.close_app)

        menu_about = menu_bar.addMenu('Sobre')
        menu_about.addAction('Sobre este app', self.about)
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QColorDialog().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widgets.
        vbox = QVBoxLayout()
        self.setLayout(vbox)

        self.label = QLabel('Cor selecionada')
        self.label.setAutoFillBackground(True)
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        button = QPushButton('Abrir diálogo de seleção de cor')
        button.clicked.connect(self.open_dialog)
        vbox.addWidget(button)
Example #12
0
 def toggle_play_and_pause(self):
     if self.paused:
         # 继续计时
         # 把继续图标换回暂停图标
         icon_pause = QIcon()
         icon_pause.addPixmap(
             QPixmap(":/icons/icons/ic_pause_black_48dp.png"),
             QIcon.Normal,
             QIcon.Off,
         )
         self.question_panel.ui.pushButtonPause.setIcon(icon_pause)
         # 重新开始计时,包括1秒定时器和总时间计时器
         self.timer.start(1000)
         self.elapsed_time.restart()
         # 把自身状态标记为非暂停状态
         self.paused = False
     else:
         # 暂停计时
         icon_play = QIcon()
         icon_play.addPixmap(
             QPixmap(":/icons/icons/ic_play_arrow_black_48dp.png"),
             QIcon.Normal,
             QIcon.Off,
         )
         self.question_panel.ui.pushButtonPause.setIcon(icon_play)
         self.totaltime += self.elapsed_time.elapsed()
         self.timer.stop()
         self.paused = True
Example #13
0
    def _add_additional_qactions_tool_bar_view(self):
        """Programatically add the side toolbar buttons for showing/hiding the main docks
        such as create coomponent, edit one, log dock, etc."""
        toolbar = self.ui.toolBarView
        toolbarInsertBefore = self.ui.actionToggleDocks  # insert before this action

        DOCKS = [(self.ui.dockLibrary, r":/design"),
                 (self.ui.dockDesign, r":/component"), (None, '-----'),
                 (self.ui.dockVariables, r":/variables"),
                 (self.ui.dockConnectors, r":/connectors"),
                 (self.ui.dockLog, r":/log"), (None, '-----')]

        for row in DOCKS:
            dock = row[0]
            iconName = row[1]
            if iconName == '-----':
                toolbar.insertSeparator(toolbarInsertBefore)
                continue

            # Icons
            icon = QIcon()
            icon.addPixmap(QPixmap(iconName), QIcon.Normal, QIcon.Off)

            # Function call & monkey patch class instance
            dock.doShow = doShowHighlighWidget.__get__(dock, type(dock))  # pylint: disable=assignment-from-no-return

            # QT Action with trigger, embed in toolbar
            action = QAction('', dock, triggered=dock.doShow)
            action.setIcon(icon)
            dock.actionShow = action  # save action

            # insert action in toolbar
            toolbar.insertAction(toolbarInsertBefore, action)
Example #14
0
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QMessageBox().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widgets.
        vbox = QVBoxLayout()
        self.setLayout(vbox)

        self.label = QLabel('Clique no botão para abrir o diálogo.')
        self.label.setAutoFillBackground(True)
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        btn_dialog = QPushButton('Abrir diálogo do tipo caixa de mensagem')
        btn_dialog.clicked.connect(self.open_dialog)
        vbox.addWidget(btn_dialog)

        btn_dialog_about = QPushButton('Abrir diálogo do tipo sobre (about)')
        btn_dialog_about.clicked.connect(self.open_dialog_about)
        vbox.addWidget(btn_dialog_about)

        btn_dialog_aboutqt = QPushButton('Abrir diálogo do tipo sobre (aboutqt)')
        btn_dialog_aboutqt.clicked.connect(self.open_dialog_aboutqt)
        vbox.addWidget(btn_dialog_aboutqt)

        btn_dialog_critical = QPushButton('Abrir diálogo do tipo crítico (critical)')
        btn_dialog_critical.clicked.connect(self.open_dialog_critical)
        vbox.addWidget(btn_dialog_critical)

        btn_dialog_information = QPushButton('Abrir diálogo do tipo informação (information)')
        btn_dialog_information.clicked.connect(self.open_dialog_information)
        vbox.addWidget(btn_dialog_information)

        btn_dialog_question = QPushButton('Abrir diálogo do tipo questão (question)')
        btn_dialog_question.clicked.connect(self.open_dialog_question)
        vbox.addWidget(btn_dialog_question)

        btn_dialog_warning = QPushButton('Abrir diálogo do tipo alerta (warning)')
        btn_dialog_warning.clicked.connect(self.open_dialog_warning)
        vbox.addWidget(btn_dialog_warning)
Example #15
0
    def create_icons(self):
        folder_icon = QIcon()
        folder_icon.addPixmap(QPixmap(self.FOLDER_ICON_PATH), QIcon.Normal, QIcon.Off)

        audio_icon = QIcon()
        audio_icon.addPixmap(QPixmap(self.AUDIO_ICON_PATH), QIcon.Normal, QIcon.Off)
        icons = {"folder": folder_icon, "audio": audio_icon}
        return icons
Example #16
0
    def load_dataList(self, nameList, showThumbnail=True, progressBar=True):
        self.dataList.clear()
        if progressBar:
            progress = QProgressDialog("Loading data...", "Abort", \
                0, len(nameList), self.window)
            progress.setWindowModality(Qt.WindowModal)
        for i, dataName in enumerate(nameList):
            newItem = QtWidgets.QListWidgetItem(dataName)
            # Mark finished data
            if self.in_task and (dataName in self.current_task.finished_data):
                newItem.setBackground(QBrush(QColor("#b3b3b3")))

            if showThumbnail:
                # boring img down sizing and img format converting
                img = Image.open(self.current_data_dir + IMG_FOLDER \
                    + '/' + dataName + '.' + IMG_EXT)
                w, h = img.size
                img = img.resize((128, int(128 * h / w)))
                img = img.convert("RGBA")
                qimg = QImage(img.tobytes('raw', 'RGBA'), img.size[0], \
                    img.size[1], QImage.Format_RGBA8888)
                thumbnail = QIcon()
                thumbnail.addPixmap(QtGui.QPixmap.fromImage(qimg))
                newItem.setIcon(thumbnail)

            # pre load all the labels
            label_dir = self.current_data_dir + LEBEL_FOLDER \
                + '/' + dataName + '.txt'
            if os.path.exists(label_dir):
                with open(label_dir, 'r') as label_file:
                    bboxs = []
                    for line in label_file:
                        bbox_l = line.split()
                        class_num = int(bbox_l[0])
                        centerX = int(float(bbox_l[1]) * w)
                        centerY = int(float(bbox_l[2]) * h)
                        width = int(float(bbox_l[3]) * w)
                        height = int(float(bbox_l[4]) * h)
                        new_bbox = BBox([centerX, centerY, width, height],\
                                [w, h], class_num)
                        bboxs.append(new_bbox)

                    label_table[dataName] = bboxs
            else:
                # self.error_msg("Cannot find label: " + \
                #     label_dir)
                # if the label do not exist, create an empty bbox list
                bboxs = []
                label_table[dataName] = bboxs

            self.dataList.addItem(newItem)
            if progressBar:
                progress.setValue(i)
                if progress.wasCanceled():
                    break
        if progressBar:
            progress.setValue(len(nameList))
Example #17
0
 def set_icon(self, widget: QWidget, icon: str) -> None:
     """Associates an icon to a widget."""
     i = QIcon()
     i.addPixmap(
         QPixmap(
             os.path.abspath(
                 os.path.join(self.rootdir, 'src', 'default_icons',
                              f'{icon}.svg'))))
     widget.setIcon(QIcon.fromTheme(icon, i))
 def open_icon_dialog(self):
     filename = QFileDialog.getOpenFileName(self._ui.dialog_frame,
                                            "Choose process icon", "/home",
                                            ICON_FILE)
     icon_size = self._ui.button_icon.iconSize()
     icon = QIcon()
     icon.addPixmap(QPixmap(filename[0]), QIcon.Normal, QIcon.Off)
     self._ui.button_icon.setIcon(icon)
     self._ui.button_icon.setIconSize(icon_size)
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QInputDialog().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widgets.
        vbox = QVBoxLayout()
        self.setLayout(vbox)

        self.label = QLabel('Clique nos botões para abrir os diálogos.')
        self.label.setAutoFillBackground(True)
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        btn_input_text = QPushButton('Abrir diálogo de input de texto')
        btn_input_text.clicked.connect(self.open_input_text_dialog)
        vbox.addWidget(btn_input_text)

        btn_input_mult_line = QPushButton(
            'Abrir diálogo de input de texto multi linha')
        btn_input_mult_line.clicked.connect(
            self.open_input_mult_line_text_dialog)
        vbox.addWidget(btn_input_mult_line)

        btn_input_int = QPushButton('Abrir diálogo de input de numero intero')
        btn_input_int.clicked.connect(self.open_input_int_dialog)
        vbox.addWidget(btn_input_int)

        btn_input_float = QPushButton(
            'Abrir diálogo de input de numero com ponto flutuante')
        btn_input_float.clicked.connect(self.open_input_float_dialog)
        vbox.addWidget(btn_input_float)

        btn_input_choice = QPushButton(
            'Abrir diálogo de input de seleção de itens')
        btn_input_choice.clicked.connect(self.open_input_choice_dialog)
        vbox.addWidget(btn_input_choice)
Example #20
0
 def set_popup(self, value):
     self._popup = value
     if not self.actions():
         dropdown_icon = QIcon()
         dropdown_icon.addPixmap(
             QPixmap(":/icons/img/[email protected]"), QIcon.Normal,
             QIcon.Off)
         dropdown_icon.actualSize(QSize(10, 10))
         popup_action = self.addAction(dropdown_icon,
                                       QLineEdit.TrailingPosition)
         popup_action.triggered.connect(self.show_popup)
 def updateImgButton(self):
     # cv2.imwrite(self.tmpFile, self.img, (cv2.IMWRITE_PNG_COMPRESSION, 9))
     icon = QIcon()
     icon.addPixmap(self.img.toqpixmap())
     width = self._parent.ui.functions.width() - 51
     self._table.setColumnWidth(0, width - 20)
     size = QSize(width - 20, self.img.height)
     self.setIconSize(size)
     self._table.setRowHeight(self._row, self.img.height)
     self.setIcon(icon)
     # self.setIcon(QIcon(self.tmpFile))
     self.setStyleSheet("QPushButton { text-align: left; }")
    def __init__(self):
        super().__init__()
        # Título da janela.
        self.setWindowTitle('PySide2 QFileDialog().')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Widget central.
        widget = QWidget()
        self.setCentralWidget(widget)

        # Widgets.
        vbox = QVBoxLayout()
        widget.setLayout(vbox)

        self.label = QLabel('Clique em um dos botões')
        self.label.setAutoFillBackground(True)
        self.label.setAlignment(Qt.AlignCenter)
        vbox.addWidget(self.label)

        btn_open_file = QPushButton('Selecionar arquivo')
        btn_open_file.clicked.connect(self.open_file_dialog)
        vbox.addWidget(btn_open_file)

        btn_open_files = QPushButton('Selecionar arquivos')
        btn_open_files.clicked.connect(self.open_files_dialog)
        vbox.addWidget(btn_open_files)

        btn_open_dir = QPushButton('Selecionar um diretório')
        btn_open_dir.clicked.connect(self.open_dir_dialog)
        vbox.addWidget(btn_open_dir)

        btn_save_file = QPushButton('Salvar um arquivo')
        btn_save_file.clicked.connect(self.open_save_dialog)
        vbox.addWidget(btn_save_file)
Example #23
0
    def loadIcon(cls, iconName):
        """
        Load icon from file.
        
        :param iconName:  Name of the icon (with extension).
        :type iconName: string | IconName
        :return: Loaded icon.
        :rtype:  QIcon
        """
        icon = QIcon()
        if isinstance(iconName, IconName):
            iconName = iconName.value

        icon.addPixmap(QPixmap(os.path.join(cls.ICON_FOLDER, iconName)))
        return icon
Example #24
0
 def __init__(self):
     super().__init__()
     # Resolução do monitor.
     screen_size = app.primaryScreen().geometry()
     width = screen_size.width()
     height = screen_size.height()
     # Tamanho inicial da janela.
     self.resize(int(width / 2), int(height / 2))
     # Tamanho mínimo da janela.
     self.setMinimumSize(int(width / 3), int(height / 3))
     # Título da janela.
     self.setWindowTitle('PySide2 janela QWidget()')
     # Ícone da janela principal
     icon = QIcon()
     icon.addPixmap(QPixmap('../assets/icons/icon.png'))
     self.setWindowIcon(icon)
    def about(self):
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))

        message_box = QMessageBox(parent=self)
        message_box.setWindowTitle('Título da caixa de texto')
        message_box.setWindowIcon(icon)
        message_box.setText(
            'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do '
            'eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim '
            'ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut '
            'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit '
            'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. '
            'Excepteur sint occaecat cupidatat non proident, sunt in culpa '
            'qui officia deserunt mollit anim id est laborum.'
        )
        message_box.exec()
Example #26
0
    def __init__(self):
        super(MainWindow, self).__init__()
        # Título da janela.
        self.setWindowTitle('QGridLayout com QMainWindow.')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Layout.
        grid_layout = QGridLayout()

        # Widget central.
        widget = QWidget()
        widget.setLayout(grid_layout)
        self.setCentralWidget(widget)

        button1 = QPushButton('Button 1')
        grid_layout.addWidget(button1, 0, 0)

        button2 = QPushButton('Button 2')
        grid_layout.addWidget(button2, 0, 1)

        button3 = QPushButton('Button 3')
        # addWidget(arg__1, row, column, rowSpan, columnSpan, alignment)
        grid_layout.addWidget(button3, 1, 0, 1, 2)

        button4 = QPushButton('Button 4')
        grid_layout.addWidget(button4, 2, 0)

        button5 = QPushButton('Button 5')
        grid_layout.addWidget(button5, 2, 1)
 def init_content(self):
     """initialise new process with empty inputs"""
     self._ui.process_name.setText("Process Name")
     icon = QIcon()
     icon.addPixmap(QPixmap(":/icons/img/[email protected]"),
                    QIcon.Normal, QIcon.Off)
     self._ui.button_icon.setIcon(icon)
     self._section_popup_model.value = OverviewSelection.ENERGY
     self._category_popup_model.value = ProcessCategory.SUPPLY
     self._ui.variables_list.setModel(ListModel([]))
     self._ui.data_list.setModel(ListModel([]))
     self._ui.properties_list.setModel(ListModel([]))
     self._ui.inputs_list.setModel(ListModel([]))
     self._ui.outputs_list.setModel(ListModel([]))
     self._ui.objective_value.setText("Process Objective Function")
     self._ui.constraints_value.setText("Process Constraints")
     self._new_process = True
Example #28
0
    def _add_additional_qactions_tool_bar_view(self):
        """Add QActions to toolBarView that cannot be added via QDesign"""

        # Library
        self.dock_library_qaction = self.ui.dockLibrary.toggleViewAction()
        library_icon = QIcon()
        library_icon.addPixmap(QPixmap(":/component"), QIcon.Normal, QIcon.Off)
        self.dock_library_qaction.setIcon(library_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_library_qaction)

        # Design
        self.dock_design_qaction = self.ui.dockDesign.toggleViewAction()
        design_icon = QIcon()
        design_icon.addPixmap(QPixmap(":/design"), QIcon.Normal, QIcon.Off)
        self.dock_design_qaction.setIcon(design_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_design_qaction)

        # Variables
        self.dock_variables_qaction = self.ui.dockVariables.toggleViewAction()
        variables_icon = QIcon()
        variables_icon.addPixmap(QPixmap(":/variables"), QIcon.Normal,
                                 QIcon.Off)
        self.dock_variables_qaction.setIcon(variables_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_variables_qaction)

        # Connectors
        self.dock_connectors_qaction = self.ui.dockConnectors.toggleViewAction(
        )
        connectors_icon = QIcon()
        connectors_icon.addPixmap(QPixmap(":/connectors"), QIcon.Normal,
                                  QIcon.Off)
        self.dock_connectors_qaction.setIcon(connectors_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_connectors_qaction)

        # Log
        self.dock_log_qaction = self.ui.dockLog.toggleViewAction()
        log_icon = QIcon()
        log_icon.addPixmap(QPixmap(":/log"), QIcon.Normal, QIcon.Off)
        self.dock_log_qaction.setIcon(log_icon)
        self.ui.toolBarView.insertAction(self.ui.actionToggleDocks,
                                         self.dock_log_qaction)
Example #29
0
    def __init__(self, addNewTag=True, deletetable=True, parent=None):
        super().__init__(parent)

        self.layout = FlowLayout(3, 5, 5)
        self.setLayout(self.layout)

        self.addNewTag = addNewTag
        self.deletable = deletetable

        if addNewTag:
            self.button = QPushButton(self)
            self.button.clicked.connect(self.showAddEdit)
            icon = QIcon()
            icon.addPixmap(QPixmap("D:/work/py37/PySide/icons/plus.png"), QIcon.Normal, QIcon.On)
            self.button.setIcon(icon)
            self.button.setFlat(True)

        self.tags = []
Example #30
0
    def __init__(self):
        """
		This class is the menu that shows when a component is right clicked in the TGUIM view.
		
		Constructing a ComponentMenu creates the menu items, but does not connect any actions. To
		connect the menu items to internal logic, use the methods that start with "on". For
		instance, the *onBlink* method connects the "Show in target GUI" menu item to the
		function passed in. Of course, that function should execute code to use the blinker
		appropriately.
		"""
        QMenu.__init__(self)

        self.blinkAction = self.addAction("Show in target GUI")
        blinkIcon = QIcon()
        blinkIcon.addPixmap(
            QPixmap(":/icon/resources/icons/office/spotlight.png"),
            QIcon.Normal, QIcon.Off)
        self.blinkAction.setIcon(blinkIcon)