Пример #1
0
    def __init__(self, title, data, parent=None):
        super(EnvDisplay, self).__init__(parent=parent)
        self.data = data
        self.tree = EnvTree('environ', self.data)
        self.ok_button = QtGui.QPushButton('Ok')
        self.ok_button.setSizePolicy(
            QtGui.QSizePolicy.Maximum,
            QtGui.QSizePolicy.Maximum,
        )
        self.ok_button.clicked.connect(self.accept)
        self.copy_button = QtGui.QPushButton(
            icon=QtGui.QIcon(res.get_path('copy.png')),
            text='Copy to Clipboard',
        )
        self.copy_button.clicked.connect(self.copy_to_clipboard)

        self.button_layout = QtGui.QHBoxLayout()
        self.button_layout.setDirection(self.button_layout.RightToLeft)
        self.button_layout.addWidget(self.ok_button)
        self.button_layout.addWidget(self.copy_button)
        self.button_layout.addStretch()

        self.layout = QtGui.QVBoxLayout()
        self.layout.addWidget(self.tree)
        self.layout.addLayout(self.button_layout)
        self.setLayout(self.layout)
        self.setWindowTitle(title)
        self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png')))
Пример #2
0
    def __init__(self, editor_widget, parent=None):
        """
        Initialize the wrapper widget.

        :param editor_widget: The ``EDITOR`` widget instance
        :type editor_widget: :class:`~PySide.QtGui.QWidget`
        :param parent: The parent widget instance or None
        :type parent: :class:`~PySide.QtGui.QWidget`
        :return:
        """
        super(_EditorWidget, self).__init__(parent)
        self._editor_widget = editor_widget
        self._editor_widget.setFocusPolicy(QtCore.Qt.StrongFocus)

        self._done_btn = QtGui.QPushButton()
        self._done_btn.setIcon(QtGui.QIcon(":/qtwidgets-shotgun-fields/edit_close.png"))
        self._done_btn.setFixedSize(QtCore.QSize(16, 16))
        self._done_btn.setFocusPolicy(QtCore.Qt.NoFocus)

        self._apply_btn = QtGui.QPushButton()
        self._apply_btn.setIcon(
            QtGui.QIcon(":/qtwidgets-shotgun-fields/apply_value.png")
        )
        self._apply_btn.setFixedSize(QtCore.QSize(16, 16))
        self._apply_btn.setFocusPolicy(QtCore.Qt.NoFocus)

        # make sure there's never a bg color or border
        self._done_btn.setStyleSheet(BUTTON_STYLE)
        self._apply_btn.setStyleSheet(BUTTON_STYLE)

        if self._editor_widget.sizeHint().height() >= 32:
            btn_layout = QtGui.QVBoxLayout()
            btn_layout.addWidget(self._done_btn)
            btn_layout.addStretch()
            btn_layout.addWidget(self._apply_btn)
        else:
            btn_layout = QtGui.QHBoxLayout()
            btn_layout.addWidget(self._apply_btn)
            btn_layout.addWidget(self._done_btn)
            btn_layout.addStretch()

        if getattr(editor_widget, "_IMMEDIATE_APPLY", None):
            # widget is set to immediately apply value. no need to display the btn
            self._apply_btn.hide()

        layout = QtGui.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(4)
        layout.addWidget(editor_widget)
        layout.addLayout(btn_layout)
        layout.addStretch()

        layout.setAlignment(self._done_btn, QtCore.Qt.AlignBottom)

        self.installEventFilter(self)

        # ---- connect singals

        self._done_btn.clicked.connect(lambda: self.done_editing.emit())
        self._apply_btn.clicked.connect(self._apply_value)
Пример #3
0
    def __init__(self, environment, parent):
        super(EnvPermissions, self).__init__(parent)

        self.state = {
            'environment': environment,
        }

        self.save_button = QtGui.QPushButton('Save')
        self.cancel_button = QtGui.QPushButton('Cancel')

        # Layout widgets
        button_layout = QtGui.QHBoxLayout()
        button_layout.addWidget(self.save_button)
        button_layout.addWidget(self.cancel_button)

        self.layout = QtGui.QVBoxLayout()
        self.layout.addWidget(QtGui.QLabel('Restrict to Users'))
        self.layout.addLayout(button_layout)
        self.setLayout(self.layout)

        # Connect widgets
        self.save_button.clicked.connect(self.on_save_clicked)
        self.cancel_button.clicked.connect(self.on_cancel_clicked)

        self.setWindowTitle('Environment Permissions')
        self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png')))

        shotgun_fields = sgtk.platform.import_framework(
            "tk-framework-qtwidgets",
            "shotgun_fields",
        )
        self._fields_manager = shotgun_fields.ShotgunFieldManager(self)
        self._fields_manager.initialized.connect(self.on_initialized)
        self._fields_manager.initialize()
 def create_layout(self):
     # Create a main layout
     self.layout = QtGui.QVBoxLayout()
     # Create the widgets
     self.enable_notifications_checkbox = QtGui.QCheckBox(
         'Enable Notifications')
     self.start_button = QtGui.QPushButton(self.START_TEXT)
     self.status_label = QtGui.QLabel('Status')
     self.status = QtGui.QLabel(self.STATUS_STOPPED)
     self.close_button = QtGui.QPushButton('Close')
     # Layout the status label and text
     self.status_layout = QtGui.QHBoxLayout()
     self.status_layout.addStretch(1)
     self.status_layout.addWidget(self.status_label, 0)
     self.status_layout.addWidget(self.status, 0)
     # Layout the close button
     self.footer_layout = QtGui.QHBoxLayout()
     self.footer_layout.addStretch(2)
     self.footer_layout.addWidget(self.close_button, 1)
     # Layout all the layout and widgets
     self.layout.addWidget(self.enable_notifications_checkbox, 0)
     self.layout.addWidget(self.start_button, 0)
     self.layout.addStretch(1)
     self.layout.addLayout(self.status_layout, 0)
     self.layout.addLayout(self.footer_layout, 0)
     # Set the main layout in the widget
     self.setLayout(self.layout)
Пример #5
0
    def __init__(self, parent):
        super(EnvImporter, self).__init__(parent)

        self.state = {
            'projects': None,
            'project': None,
            'environments': None,
            'environment': None,
        }

        # Can't get this search widget to work right...
        # search = sgtk.platform.import_framework(
        #     "tk-framework-qtwidgets",
        #     "shotgun_search_widget",
        # )
        # self.project_search = search.GlobalSearchWidget(self)
        # self.project_search.set_searchable_entity_types({'Project': []})
        # self.project_search.set_placeholder_text('Search for Project')
        # self.project_search.entity_activated.connect(self.on_entity_activated)

        # Create widgets
        self.project_search = QtGui.QComboBox()
        self.env_list = QtGui.QComboBox()
        self.engine = QtGui.QLineEdit()
        self.engine.setReadOnly(True)
        self.engine.setFocusPolicy(QtCore.Qt.NoFocus)
        self.req_list = QtGui.QListWidget()
        self.import_button = QtGui.QPushButton('Import')
        self.cancel_button = QtGui.QPushButton('Cancel')

        # Layout widgets
        button_layout = QtGui.QHBoxLayout()
        button_layout.addWidget(self.import_button)
        button_layout.addWidget(self.cancel_button)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(QtGui.QLabel('Project'))
        layout.addWidget(self.project_search)
        layout.addWidget(QtGui.QLabel('Environment'))
        layout.addWidget(self.env_list)
        layout.addWidget(QtGui.QLabel('Engine'))
        layout.addWidget(self.engine)
        layout.addWidget(QtGui.QLabel('Requires'))
        layout.addWidget(self.req_list)
        layout.addLayout(button_layout)
        self.setLayout(layout)

        # Connect widgets
        self.project_search.activated.connect(self.on_project_changed)
        self.env_list.activated.connect(self.on_env_changed)
        self.import_button.clicked.connect(self.on_import_clicked)
        self.cancel_button.clicked.connect(self.on_cancel_clicked)

        self.setWindowTitle('Import Environments')
        self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png')))

        self.update_projects()
Пример #6
0
    def setupUi(self, FileOpenForm):
        FileOpenForm.setObjectName("FileOpenForm")
        FileOpenForm.resize(956, 718)
        self.verticalLayout = QtGui.QVBoxLayout(FileOpenForm)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setSpacing(12)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.nav = NavigationWidget(FileOpenForm)
        self.nav.setMinimumSize(QtCore.QSize(80, 30))
        self.nav.setStyleSheet("#history_btns {\n"
"background-color: rgb(255, 128, 0);\n"
"}")
        self.nav.setObjectName("nav")
        self.horizontalLayout_3.addWidget(self.nav)
        self.breadcrumbs = BreadcrumbWidget(FileOpenForm)
        self.breadcrumbs.setStyleSheet("#breadcrumbs {\n"
"background-color: rgb(255, 128, 0);\n"
"}")
        self.breadcrumbs.setObjectName("breadcrumbs")
        self.horizontalLayout_3.addWidget(self.breadcrumbs)
        self.horizontalLayout_3.setStretch(1, 1)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.browser = BrowserForm(FileOpenForm)
        self.browser.setStyleSheet("#browser {\n"
"background-color: rgb(255, 128, 0);\n"
"}")
        self.browser.setObjectName("browser")
        self.verticalLayout.addWidget(self.browser)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.new_file_btn = QtGui.QPushButton(FileOpenForm)
        self.new_file_btn.setObjectName("new_file_btn")
        
        # self.new_file_btn.setVisible(False) # <<<< 

        self.horizontalLayout.addWidget(self.new_file_btn)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.cancel_btn = QtGui.QPushButton(FileOpenForm)
        self.cancel_btn.setObjectName("cancel_btn")
        self.horizontalLayout.addWidget(self.cancel_btn)
        self.open_btn = QtGui.QPushButton(FileOpenForm)
        self.open_btn.setStyleSheet("#open_btn {\n"
"}")
        self.open_btn.setObjectName("open_btn")
        self.horizontalLayout.addWidget(self.open_btn)
        self.open_options_btn = QtGui.QPushButton(FileOpenForm)
        self.open_options_btn.setFlat(False)
        self.open_options_btn.setObjectName("open_options_btn")
        self.horizontalLayout.addWidget(self.open_options_btn)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.setStretch(1, 1)

        self.retranslateUi(FileOpenForm)
        QtCore.QMetaObject.connectSlotsByName(FileOpenForm)
Пример #7
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(490, 618)
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.browser = SceneBrowserWidget(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.browser.sizePolicy().hasHeightForWidth())
        self.browser.setSizePolicy(sizePolicy)
        self.browser.setObjectName("browser")
        self.verticalLayout.addWidget(self.browser)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setSpacing(3)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.groupBox = QtGui.QGroupBox(Dialog)
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox)
        self.horizontalLayout_2.setSpacing(10)
        self.horizontalLayout_2.setContentsMargins(2, 2, 2, 2)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label = QtGui.QLabel(self.groupBox)
        self.label.setObjectName("label")
        self.horizontalLayout_2.addWidget(self.label)
        self.chk_green = QtGui.QCheckBox(self.groupBox)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/res/green_bullet.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.chk_green.setIcon(icon)
        self.chk_green.setObjectName("chk_green")
        self.horizontalLayout_2.addWidget(self.chk_green)
        self.chk_red = QtGui.QCheckBox(self.groupBox)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/res/red_bullet.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.chk_red.setIcon(icon1)
        self.chk_red.setObjectName("chk_red")
        self.horizontalLayout_2.addWidget(self.chk_red)
        self.horizontalLayout_3.addWidget(self.groupBox)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.select_all = QtGui.QPushButton(Dialog)
        self.select_all.setObjectName("select_all")
        self.horizontalLayout_3.addWidget(self.select_all)
        self.update = QtGui.QPushButton(Dialog)
        self.update.setObjectName("update")
        self.horizontalLayout_3.addWidget(self.update)
        self.verticalLayout.addLayout(self.horizontalLayout_3)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
Пример #8
0
    def __init__(self, parent=None):
        """
        Initialize the demo widget.
        """

        # call the base class init
        super(HelpScreenPopupDemo, self).__init__(parent)

        # get a handle on the current toolkit bundle (the demo app). the help
        # screen popup dialog uses this to link back to documentation as well as
        # logging.
        self._app = sgtk.platform.current_bundle()

        # a label with info about how the show method works
        show_lbl = QtGui.QLabel(
            "Click the button below to call the <tt>show_help_screen()</tt> "
            "method. This method accepts a list of <tt>650x400</tt> "
            "<tt>QPixmap</tt>s to display in a series of slides.")
        show_lbl.setWordWrap(True)

        # a button to trigger the help screen popup
        show_btn = QtGui.QPushButton("show_help_screen()")
        show_btn.clicked.connect(self._on_show_btn_clicked)

        btn_layout = QtGui.QHBoxLayout()
        btn_layout.addStretch()
        btn_layout.addWidget(show_btn)
        btn_layout.addStretch()

        # lay out the widgets
        layout = QtGui.QVBoxLayout(self)
        layout.addStretch()
        layout.addWidget(show_lbl)
        layout.addLayout(btn_layout)
        layout.addStretch()
Пример #9
0
    def create_ui(self):
        self.dialog = QtGui.QDialog()
        self.dialog.setWindowTitle('Select Item Type')
        self.dialog.setMinimumWidth(300)
        self.dialog.setMinimumHeight(100)
        self.dialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint
                                   | QtCore.Qt.WindowTitleHint)
        self.dialog.keyPressEvent = self.key_press_event
        main_layout = QtGui.QVBoxLayout(self.dialog)

        qtwidgets = sgtk.platform.framework.load_framework(
            self.engine, self.engine.context, self.engine.env,
            "tk-framework-qtwidgets_v2.x.x")
        elided_label = qtwidgets.import_module("elided_label")

        path_label = elided_label.ElidedLabel()
        path_label.setText("File Name: {}".format(self.path))
        main_layout.addWidget(path_label)
        # create list widget with items
        self.items_list_widget = QtGui.QListWidget()
        self.items_list_widget.addItems(self.item_types)
        main_layout.addWidget(self.items_list_widget)
        # select first item
        self.items_list_widget.setCurrentRow(0)
        # create "OK" button
        ok_button = QtGui.QPushButton("OK")
        ok_button.clicked.connect(self.get_selected_item)
        main_layout.addWidget(ok_button)
        self.dialog.exec_()
Пример #10
0
    def setupUi(self, AboutScreen):
        AboutScreen.setObjectName("AboutScreen")
        AboutScreen.resize(325, 385)
        AboutScreen.setMinimumSize(QtCore.QSize(320, 327))
        self.verticalLayout = QtGui.QVBoxLayout(AboutScreen)
        self.verticalLayout.setSpacing(15)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.icon = QtGui.QLabel(AboutScreen)
        self.icon.setMinimumSize(QtCore.QSize(100, 100))
        self.icon.setMaximumSize(QtCore.QSize(100, 100))
        self.icon.setText("")
        self.icon.setPixmap(QtGui.QPixmap(":/tk-desktop/shotgun_logo.png"))
        self.icon.setScaledContents(True)
        self.icon.setObjectName("icon")
        self.horizontalLayout.addWidget(self.icon)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.header = QtGui.QLabel(AboutScreen)
        self.header.setStyleSheet("font-size: 16px;")
        self.header.setAlignment(QtCore.Qt.AlignCenter)
        self.header.setWordWrap(True)
        self.header.setObjectName("header")
        self.verticalLayout.addWidget(self.header)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.body = QtGui.QLabel(AboutScreen)
        self.body.setAlignment(QtCore.Qt.AlignCenter)
        self.body.setWordWrap(True)
        self.body.setObjectName("body")
        self.verticalLayout.addWidget(self.body)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.copyright = QtGui.QLabel(AboutScreen)
        self.copyright.setStyleSheet("font-size: 10px;")
        self.copyright.setAlignment(QtCore.Qt.AlignCenter)
        self.copyright.setWordWrap(True)
        self.copyright.setObjectName("copyright")
        self.verticalLayout.addWidget(self.copyright)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem2)
        self.buttonBox = QtGui.QDialogButtonBox(AboutScreen)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(False)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout_2.addWidget(self.buttonBox)
        self.licensesButton = QtGui.QPushButton(AboutScreen)
        self.licensesButton.setObjectName("licensesButton")
        self.horizontalLayout_2.addWidget(self.licensesButton)
        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(AboutScreen)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AboutScreen.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AboutScreen.reject)
        QtCore.QMetaObject.connectSlotsByName(AboutScreen)
Пример #11
0
    def __init__(self, parent=None):
        super(ProgressDialog, self).__init__(parent)

        # Window options
        self.setWindowTitle('tk-cpenv')
        self.setWindowIcon(QtGui.QIcon(res.get_path('module_dark_256.png')))
        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)
        self.hide_timer = None

        # Layout widgets
        self.label = QtGui.QLabel('Starting...')
        self.progress = QtGui.QProgressBar()
        self.progress.setRange(0, 100)
        self.progress.setTextVisible(True)
        self.progress.setAlignment(QtCore.Qt.AlignCenter)
        self.progress.setFormat('starting')
        self.frame = QtGui.QLabel()
        self.button = QtGui.QPushButton('Cancel')
        self.button.setSizePolicy(
            QtGui.QSizePolicy.Maximum,
            QtGui.QSizePolicy.Maximum,
        )
        self.button.clicked.connect(self.cancel)

        self.layout = QtGui.QVBoxLayout()
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.progress)
        self.layout.addWidget(self.frame)
        self.layout.addWidget(self.button)
        self.layout.setAlignment(self.button, QtCore.Qt.AlignRight)
        self.setLayout(self.layout)
Пример #12
0
    def __init__(self, environments, parent=None):
        super(EnvSelector, self).__init__(parent)

        self.state = {
            'environments': environments,
            'choice': environments[0],
        }

        self.msg = QtGui.QLabel('Select an Environment')
        self.msg.setAlignment(QtCore.Qt.AlignCenter)

        buttons = []
        for environment in environments:
            button = QtGui.QPushButton(environment['code'])
            button.setToolTip(
                'Modules:\n'
                + '\n'.join(environment['sg_requires'].split())
            )
            button.setObjectName('SelectButton')
            button.clicked.connect(self.choose(environment))
            buttons.append(button)

        # Layout widgets
        self.layout = QtGui.QVBoxLayout()
        self.layout.addWidget(self.msg)
        for button in buttons:
            self.layout.addWidget(button)
        self.setLayout(self.layout)

        self.setWindowTitle('tk-cpenv')
        self.setWindowIcon(QtGui.QIcon(res.get_path('icon_dark_256.png')))
        self.setStyleSheet(self.style)
Пример #13
0
    def __init__(self, label, message, parent=None):
        super(ErrorDialog, self).__init__(parent)

        self.setWindowTitle('tk-multi-tickets Error')
        self.setWindowIcon(QtGui.QIcon(res.get_path('icon_256.png')))
        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.label = QtGui.QLabel(label)
        self.text = QtGui.QPlainTextEdit(message)
        self.text.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)

        self.button = QtGui.QPushButton('Dismiss')
        self.button.setSizePolicy(
            QtGui.QSizePolicy.Maximum,
            QtGui.QSizePolicy.Maximum,
        )
        self.button.clicked.connect(self.accept)

        self.layout = QtGui.QVBoxLayout()
        self.layout.setStretch(1, 1)
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)
        self.layout.setAlignment(self.button, QtCore.Qt.AlignRight)
        self.setLayout(self.layout)
    def __init__(self, parent = None ) :
        QtGui.QWidget.__init__(self, parent) 

        lay = QtGui.QHBoxLayout()
        lay.setContentsMargins(0,0,0,0)
        lay.setSpacing(0)

        self.writeTo = ToDoLineEdit("who ?") 
        self.writeWhat = ToDoLineEdit("what ?")
        self.sendButton = QtGui.QPushButton()
        self.sendButton.setIcon(QtGui.QIcon(getRessources("sendNotification") ))

        self.sendButton.setFlat(True);
        self.sendButton.setIconSize(QtCore.QSize(20,20));
        style = 'QPushButton:hover{border: 1px solid rgb(48,226,227)}'
        self.sendButton.setStyleSheet("QPushButton{outline: none;}"+style);
        self.sendButton.notificationAttr = True

        lay.addWidget(self.writeTo)
        lay.addSpacing(5)
        lay.addWidget(self.writeWhat)
        lay.addSpacing(5)
        lay.addWidget(self.sendButton)
        self.setLayout(lay)


        self.writeTo.setMaximumWidth(150)
Пример #15
0
    def setupUi(self, EntityTreeForm):
        EntityTreeForm.setObjectName("EntityTreeForm")
        EntityTreeForm.resize(349, 367)
        self.verticalLayout = QtGui.QVBoxLayout(EntityTreeForm)
        self.verticalLayout.setSpacing(4)
        self.verticalLayout.setContentsMargins(2, 6, 2, 2)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(2, -1, 2, 1)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.my_tasks_cb = QtGui.QCheckBox(EntityTreeForm)
        self.my_tasks_cb.setObjectName("my_tasks_cb")
        self.horizontalLayout.addWidget(self.my_tasks_cb)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.new_task_btn = QtGui.QPushButton(EntityTreeForm)
        self.new_task_btn.setObjectName("new_task_btn")
        self.horizontalLayout.addWidget(self.new_task_btn)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(1, -1, 1, -1)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.search_ctrl = SearchWidget(EntityTreeForm)
        self.search_ctrl.setMinimumSize(QtCore.QSize(0, 20))
        self.search_ctrl.setStyleSheet("#search_ctrl {\n"
                                       "background-color: rgb(255, 128, 0);\n"
                                       "}")
        self.search_ctrl.setObjectName("search_ctrl")
        self.horizontalLayout_2.addWidget(self.search_ctrl)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.entity_tree = QtGui.QTreeView(EntityTreeForm)
        self.entity_tree.setStyleSheet(
            "QTreeView::item {\n"
            "padding: 2px;\n"
            "}\n"
            "\n"
            "QTreeView::branch:has-children:!has-siblings:closed,\n"
            "QTreeView::branch:closed:has-children:has-siblings  {\n"
            "        border-image: none;\n"
            "        image: url(:/ts_multi_workfiles2/tree_arrow_collapsed.png);\n"
            "}\n"
            " \n"
            "QTreeView::branch:open:has-children:!has-siblings,\n"
            "QTreeView::branch:open:has-children:has-siblings   {\n"
            "        border-image: none;\n"
            "        image: url(:/ts_multi_workfiles2/tree_arrow_expanded.png);\n"
            "}")
        self.entity_tree.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.entity_tree.setProperty("showDropIndicator", False)
        self.entity_tree.setIconSize(QtCore.QSize(20, 20))
        self.entity_tree.setObjectName("entity_tree")
        self.entity_tree.header().setVisible(False)
        self.verticalLayout.addWidget(self.entity_tree)
        self.verticalLayout.setStretch(2, 1)

        self.retranslateUi(EntityTreeForm)
        QtCore.QMetaObject.connectSlotsByName(EntityTreeForm)
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)

        notificationList = []
        # sender, receiver, date, message, noteDict )
        notificationList.append( notification("Cyrilc", "john", datetime.datetime.now(), "Wait for approval ! rhooooooo lr lr bon y va oui ou non il est l'heure d'ylller j'ai faim. et de toute facon il est l'heure", "pas") )
        notificationList.append( notification("Donat", "john", datetime.datetime.now(), "Peu continuer !", "pas") )
        notificationList.append( notification("MikeB", "john", datetime.datetime.now(), "Oui c'est sympas", "pas") )
        notificationList.append( notification("Aurelien", "john", datetime.datetime.now(), "Launch Time", "pas") )
        notificationList.append( notification("Thomas", "john", datetime.datetime.now(), "Wait for appoval", "pas") )
        notificationList.append( notification("James", "john", datetime.datetime.now(), "Approved", "pas") )
        notificationList.append( notification("Mike", "john", datetime.datetime.now(), "Aurevoir John !", "pas") )
        notificationList.append( notification("Tristan", "john", datetime.datetime.now(), "Bonjour John !", "pas") )
        notificationList.append( notification("Eric", "john", datetime.datetime.now(), "Bonjour John !", "pas") )
        notificationList.append( notification("Francois", "john", datetime.datetime.now(), "Bonjour John !", "pas") )


        path_to_shotgunApi = getPathToShotgunApi()
        sys.path.append(path_to_shotgunApi)

        from shotgun_api3 import Shotgun
        self.SERVER_PATH = "https://nozon.shotgunstudio.com"
        self.SCRIPT_NAME = 'noteManager'     
        self.SCRIPT_KEY = '30b93ec002ce2e22ecd6fb31fdda6063797deed1d612b4f6ca39e8030104707c'
        self.sg = Shotgun(self.SERVER_PATH, self.SCRIPT_NAME, self.SCRIPT_KEY)
        sg_spawnedNotes = self.sg.find("CustomEntity04", [ ['sg_note','is_not', None] ] ,   ["project"] )
        for a in sg_spawnedNotes :
            print a


        self.setMinimumWidth(1000)
        self.setMinimumHeight(50)

        self.noteBarW = NotificationBar(notificationList, ["jack","popeye","james","conan le barbare"])
        button = QtGui.QPushButton("pafpaf")
        #button.clicked.connect(self.noteBarW.addNotification)

        lay = QtGui.QVBoxLayout()
        lay.addWidget(button)
        lay.addWidget(self.noteBarW)
        lay.addWidget(QtGui.QPushButton("pafpaf"))
        self.setLayout(lay)
        lay.setSpacing(0)
        lay.setContentsMargins(0,0,0,0)
        self.show()
Пример #17
0
    def __init__(self, parent=None):
        """Initialize the widget.

        :param parent: This widget's parent widget
        :type parent: :class:`~PySide.QtGui.QWidget`
        """
        super(BubbleWidget, self).__init__(parent)

        # placeholder for the underlying data this widget represents in the editor
        self._data = None

        # should not grow or shrink
        self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)

        # style the look of the bubble
        self.setObjectName("bubble")
        self.setStyleSheet("""
            #bubble {
                border: 1px solid black;
                border-radius: 5px;
                background-color: %s;
            }
            """ % self.palette().color(QtGui.QPalette.Button).name())

        # create a remove button for the widget.
        # extract a close button icon from the style and use it
        self.remove_button = QtGui.QPushButton(self)
        style = self.remove_button.style()
        icon = style.standardIcon(style.SP_TitleBarCloseButton)
        self.remove_button.setIcon(icon)
        self.remove_button.setFlat(True)
        self.remove_button.setStyleSheet("border: none")

        # placeholder for the bubble's image
        self.image_label = QtGui.QLabel(self)

        # color the text to use the SG highlight color
        text_color = QtGui.QColor(sgtk.platform.current_bundle().
                                  style_constants["SG_HIGHLIGHT_COLOR"])
        self.text_label = QtGui.QLabel(self)
        palette = self.text_label.palette()
        palette.setColor(QtGui.QPalette.WindowText, text_color)
        self.text_label.setPalette(palette)

        # layout the widgets
        self.layout = QtGui.QHBoxLayout()
        self.layout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
        self.layout.setContentsMargins(3, 1, 3, 1)
        self.layout.setSpacing(2)

        self.layout.addWidget(self.image_label, QtCore.Qt.AlignVCenter)
        self.layout.addWidget(self.text_label, QtCore.Qt.AlignVCenter)
        self.layout.addWidget(self.remove_button, QtCore.Qt.AlignVCenter)
        self.setLayout(self.layout)

        # emit the "remove_clicked" signal when the button is clicked.
        self.remove_button.clicked.connect(lambda: self.remove_clicked.emit())
Пример #18
0
    def __init__(self, parent=None):
        """
        Initialize the widget instance.
        """

        # call the base class init
        super(SpinnerWidgetDemo, self).__init__(parent)

        # create the spinner
        spinner = spinner_widget.SpinnerWidget(self)
        spinner.hide()

        # add some geometry so it will show up
        spinner.setFixedSize(QtCore.QSize(100, 100))

        # create some buttons to demo the methods
        start_spinner = QtGui.QPushButton("spinner.show()")
        start_spinner.clicked.connect(spinner.show)

        stop_spinner = QtGui.QPushButton("spinner.hide()")
        stop_spinner.clicked.connect(spinner.hide)

        # ---- layout section ----

        # set up a horizontal layout for the spinner
        spinner_layout = QtGui.QHBoxLayout()
        spinner_layout.addStretch()
        spinner_layout.addWidget(spinner)
        spinner_layout.addStretch()

        # set up a horizontal layout for the buttons
        button_layout = QtGui.QHBoxLayout()
        button_layout.addStretch()
        button_layout.addWidget(start_spinner)
        button_layout.addWidget(stop_spinner)
        button_layout.addStretch()

        # lay out the widgets
        layout = QtGui.QVBoxLayout(self)
        layout.setSpacing(20)
        layout.addLayout(button_layout)
        layout.addLayout(spinner_layout)
        layout.addStretch()
Пример #19
0
    def __init__(self, parent=None):
        """
        Initialize the demo widget.
        """

        # call the base class init
        super(EntityFieldMenuDemo, self).__init__(parent)

        # create a background task manager for each of our components to use
        self._bg_task_manager = task_manager.BackgroundTaskManager(self)

        # --- build an entity field menu

        # build a menu to display Project entity fields
        self._entity_type = "HumanUser"
        self._entity_field_menu = shotgun_menus.EntityFieldMenu(
            self._entity_type,
            self,
            bg_task_manager=self._bg_task_manager
        )

        # a button to trigger the menu
        entity_field_menu_button = QtGui.QPushButton(
            "EntityFieldMenu (%s)" % (self._entity_type,))
        entity_field_menu_button.setObjectName("entity_field_menu_button")

        # show the menu when the button is clicked
        entity_field_menu_button.clicked.connect(
            lambda: self._entity_field_menu.exec_(QtGui.QCursor.pos())
        )

        # help label for the UI
        doc = QtGui.QLabel("Click the button to show the menu.")
        doc.setAlignment(QtCore.Qt.AlignCenter)

        # lay out the widgets
        layout = QtGui.QVBoxLayout(self)
        layout.addStretch()
        layout.addWidget(doc)
        layout.addSpacing(8)
        layout.addWidget(entity_field_menu_button)
        layout.addStretch()

        layout.setAlignment(entity_field_menu_button, QtCore.Qt.AlignCenter)

        # the fields manager is used to query which fields are supported
        # for display. it can also be used to find out which fields are
        # visible to the user and editable by the user. the fields manager
        # needs time to initialize itself. once that's done, the widgets can
        # begin to be populated.
        self._fields_manager = shotgun_fields.ShotgunFieldManager(
            self, bg_task_manager=self._bg_task_manager)
        self._fields_manager.initialized.connect(self._populate_ui)
        self._fields_manager.initialize()
Пример #20
0
    def setupUi(self, OpenPublishForm):
        OpenPublishForm.setObjectName("OpenPublishForm")
        OpenPublishForm.resize(1228, 818)
        self.verticalLayout = QtGui.QVBoxLayout(OpenPublishForm)
        self.verticalLayout.setSpacing(4)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.loader_form = QtGui.QWidget(OpenPublishForm)
        self.loader_form.setStyleSheet("#loader_form {\n"
                                       "background-color: rgb(255, 128, 0);\n"
                                       "}")
        self.loader_form.setObjectName("loader_form")
        self.verticalLayout.addWidget(self.loader_form)
        self.break_line = QtGui.QFrame(OpenPublishForm)
        self.break_line.setFrameShape(QtGui.QFrame.HLine)
        self.break_line.setFrameShadow(QtGui.QFrame.Sunken)
        self.break_line.setObjectName("break_line")
        self.verticalLayout.addWidget(self.break_line)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setContentsMargins(12, 8, 12, 12)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        spacerItem = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.cancel_btn = QtGui.QPushButton(OpenPublishForm)
        self.cancel_btn.setMinimumSize(QtCore.QSize(90, 0))
        self.cancel_btn.setObjectName("cancel_btn")
        self.horizontalLayout_3.addWidget(self.cancel_btn)
        self.open_btn = QtGui.QPushButton(OpenPublishForm)
        self.open_btn.setMinimumSize(QtCore.QSize(90, 0))
        self.open_btn.setDefault(True)
        self.open_btn.setObjectName("open_btn")
        self.horizontalLayout_3.addWidget(self.open_btn)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.verticalLayout.setStretch(0, 1)

        self.retranslateUi(OpenPublishForm)
        QtCore.QMetaObject.connectSlotsByName(OpenPublishForm)
Пример #21
0
 def __init__(self):
     super(AppDialog, self).__init__()
     self.resize(800, 800)
     logger.info('Launching Asset Rename Filter...')
     self.worker = Worker()
     self.worker.trigger.connect(self.queryAssets)
     self.setWindowFlags(QtCore.Qt.Window)
     self.mainLayout = QtGui.QVBoxLayout(self)
     self.mainLayout.setContentsMargins(20, 5, 20, 20)
     self.mainLayout.setSpacing(0)
     self.listwidget = QtGui.QListWidget()
     self.listwidget.setObjectName(u'listWidget')
     self.listwidget.setSpacing(4)
     self.queryButton = QtGui.QPushButton('Query')
     self.queryButton.clicked.connect(self.startWorker)
     self.mainLayout.addWidget(self.queryButton)
     self.mainLayout.addWidget(self.listwidget)
Пример #22
0
    def setupUi(self, MyTasksForm):
        MyTasksForm.setObjectName("MyTasksForm")
        MyTasksForm.resize(359, 541)
        self.verticalLayout = QtGui.QVBoxLayout(MyTasksForm)
        self.verticalLayout.setSpacing(4)
        self.verticalLayout.setContentsMargins(2, 6, 2, 2)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(2, -1, 2, 1)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.filter_btn = QtGui.QToolButton(MyTasksForm)
        self.filter_btn.setStyleSheet("")
        self.filter_btn.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
        self.filter_btn.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.filter_btn.setAutoRaise(False)
        self.filter_btn.setObjectName("filter_btn")
        self.horizontalLayout.addWidget(self.filter_btn)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.new_task_btn = QtGui.QPushButton(MyTasksForm)
        self.new_task_btn.setObjectName("new_task_btn")
        self.horizontalLayout.addWidget(self.new_task_btn)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(1, -1, 1, -1)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.search_ctrl = SearchWidget(MyTasksForm)
        self.search_ctrl.setMinimumSize(QtCore.QSize(0, 20))
        self.search_ctrl.setStyleSheet("#search_ctrl {\n"
                                       "background-color: rgb(255, 128, 0);\n"
                                       "}")
        self.search_ctrl.setObjectName("search_ctrl")
        self.horizontalLayout_2.addWidget(self.search_ctrl)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.task_tree = QtGui.QTreeView(MyTasksForm)
        self.task_tree.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.task_tree.setProperty("showDropIndicator", False)
        self.task_tree.setRootIsDecorated(False)
        self.task_tree.setObjectName("task_tree")
        self.task_tree.header().setVisible(False)
        self.verticalLayout.addWidget(self.task_tree)
        self.verticalLayout.setStretch(2, 1)

        self.retranslateUi(MyTasksForm)
        QtCore.QMetaObject.connectSlotsByName(MyTasksForm)
Пример #23
0
    def __init__(self, display_widget, parent=None):
        """
        Initialize the wrapper widget.

        :param display_widget: The ``DISPLAY`` widget instance
        :type display_widget: :class:`~PySide.QtGui.QWidget`
        :param parent: The parent widget instance or None
        :type parent: :class:`~PySide.QtGui.QWidget`
        :return:
        """

        super(_DisplayWidget, self).__init__(parent)

        self._enabled = True

        self._display_widget = display_widget

        self._edit_btn = QtGui.QPushButton()
        self._edit_btn.setIcon(
            QtGui.QIcon(":/qtwidgets-shotgun-fields/edit_field.png"))
        self._edit_btn.setFixedSize(QtCore.QSize(16, 16))
        self._edit_btn.setFocusPolicy(QtCore.Qt.NoFocus)
        self._edit_btn.hide()

        # make sure there's never a bg color or border
        self._edit_btn.setStyleSheet(BUTTON_STYLE)

        spacer = QtGui.QWidget()
        spacer.setFixedHeight(self._edit_btn.height())
        spacer.setFixedWidth(4)

        layout = QtGui.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(display_widget)
        layout.addWidget(spacer)
        layout.addWidget(self._edit_btn)
        layout.addStretch(10)

        self.setMinimumHeight(self._edit_btn.height())

        self.installEventFilter(self)

        # ---- connect singals

        self._edit_btn.clicked.connect(lambda: self.edit_requested.emit())
Пример #24
0
    def __init__(self, parent=None):
        """
        Initialize the demo widget.
        """

        # call the base class init
        super(ShotgunMenuDemo, self).__init__(parent)

        # --- build a shotgun menu

        sg_menu = shotgun_menus.ShotgunMenu(self)
        submenu = shotgun_menus.ShotgunMenu(self)
        submenu.setTitle("Submenu")

        # create some dummy actions
        action1 = QtGui.QAction("Action 1", self)
        action2 = QtGui.QAction("Action 2", self)
        action3 = QtGui.QAction("Action 3", self)
        action4 = QtGui.QAction("Action 4", self)

        # add a group of actions to the top-level menu
        sg_menu.add_group([action1, action2, submenu], "Menu Actions")

        # add some actions to the sub menu
        submenu.add_group([action3, action4], "Submenu Actions")

        # a button to trigger the menu
        sg_menu_button = QtGui.QPushButton("ShotgunMenu")
        sg_menu_button.setFixedWidth(100)
        sg_menu_button.clicked.connect(
            lambda: sg_menu.exec_(QtGui.QCursor.pos()))
        sg_menu_button.setObjectName("sg_menu_button")

        # help label
        doc = QtGui.QLabel("Click the button to show the menu.")
        doc.setAlignment(QtCore.Qt.AlignCenter)

        # lay out and align the widgets
        layout = QtGui.QVBoxLayout(self)
        layout.addStretch()
        layout.addWidget(doc)
        layout.addSpacing(8)
        layout.addWidget(sg_menu_button)
        layout.addStretch()

        layout.setAlignment(sg_menu_button, QtCore.Qt.AlignCenter)
Пример #25
0
    def __init__(self, parent):
        """
        :param parent: Qt parent object
        :type parent: :class:`~PySide.QtGui.QWidget`
        """

        # first, call the base class and let it do its thing.
        super(ShotgunSearchWidget, self).__init__(parent)

        # trigger the completer to popup as text changes
        self.textEdited.connect(self._search_edited)

        # Taken from https://wiki.qt.io/Delay_action_to_wait_for_user_interaction
        self._delay_timer = QtCore.QTimer(self)
        self._delay_timer.timeout.connect(self._typing_timeout)
        self._delay_timer.setSingleShot(True)

        # FIXME: The following was stolen from SearchWidget. We can't refactor easily that
        # part of the code since the base classes for ShotgunSearchWidget and SearchWidget
        # are not the same, but at least the ShotgunSearchWidget has feature parity.
        self.set_placeholder_text("Search")

        # dynamically create the clear button so that we can place it over the
        # edit widget:
        self._clear_btn = QtGui.QPushButton(self)
        self._clear_btn.setFocusPolicy(QtCore.Qt.StrongFocus)
        self._clear_btn.setFlat(True)
        self._clear_btn.setCursor(QtCore.Qt.ArrowCursor)

        # Loads the style sheet for the search button.
        qss_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                "search_style.qss")
        with open(qss_file, "rt") as f:
            # apply to widget (and all its children)
            self._clear_btn.setStyleSheet(f.read())

        self._clear_btn.hide()

        h_layout = QtGui.QHBoxLayout(self)
        h_layout.addStretch()
        h_layout.addWidget(self._clear_btn)
        h_layout.setContentsMargins(3, 0, 3, 0)
        h_layout.setSpacing(0)
        self.setLayout(h_layout)
        self._clear_btn.clicked.connect(self._on_clear_clicked)
Пример #26
0
    def setupUi(self, UpdateEngine):
        UpdateEngine.setObjectName("UpdateEngine")
        UpdateEngine.resize(424, 178)
        self.verticalLayout = QtGui.QVBoxLayout(UpdateEngine)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.message = QtGui.QLabel(UpdateEngine)
        self.message.setWordWrap(True)
        self.message.setOpenExternalLinks(True)
        self.message.setObjectName("message")
        self.verticalLayout.addWidget(self.message)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.never_again_checkbox = QtGui.QCheckBox(UpdateEngine)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.never_again_checkbox.sizePolicy().hasHeightForWidth())
        self.never_again_checkbox.setSizePolicy(sizePolicy)
        self.never_again_checkbox.setObjectName("never_again_checkbox")
        self.horizontalLayout.addWidget(self.never_again_checkbox)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.ok_button = QtGui.QPushButton(UpdateEngine)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.ok_button.sizePolicy().hasHeightForWidth())
        self.ok_button.setSizePolicy(sizePolicy)
        self.ok_button.setDefault(True)
        self.ok_button.setObjectName("ok_button")
        self.horizontalLayout_2.addWidget(self.ok_button)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(UpdateEngine)
        QtCore.QMetaObject.connectSlotsByName(UpdateEngine)
Пример #27
0
    def __init__(self, parent=None):
        """
        Construction

        :param parent:    The parent widget
        """
        QtGui.QWidget.__init__(self, parent)

        # set up the UI
        self._ui = Ui_SearchWidget()
        self._ui.setupUi(self)
        self.set_placeholder_text("Search...")

        # dynamically create the clear button so that we can place it over the
        # edit widget:
        self._clear_btn = QtGui.QPushButton(self._ui.search_edit)
        self._clear_btn.setFocusPolicy(QtCore.Qt.StrongFocus)
        self._clear_btn.setFlat(True)
        self._clear_btn.setCursor(QtCore.Qt.ArrowCursor)
        style = (
            "QPushButton {"
            + "border: 0px solid;"
            + "image: url(:/tk-framework-qtwidgets/search_widget/clear_search.png);"
            + "width: 16;"
            + "height: 16;"
            + "}"
            + "QPushButton::hover {"
            + "image: url(:/tk-framework-qtwidgets/search_widget/clear_search_hover.png);"
            + "}"
        )
        self._clear_btn.setStyleSheet(style)
        self._clear_btn.hide()

        h_layout = QtGui.QHBoxLayout(self._ui.search_edit)
        h_layout.addStretch()
        h_layout.addWidget(self._clear_btn)
        h_layout.setContentsMargins(3, 0, 3, 0)
        h_layout.setSpacing(0)
        self._ui.search_edit.setLayout(h_layout)

        # hook up the signals:
        self._ui.search_edit.textEdited.connect(self._on_text_edited)
        self._ui.search_edit.returnPressed.connect(self._on_return_pressed)
        self._clear_btn.clicked.connect(self._on_clear_clicked)
Пример #28
0
    def _create_button(self, parent):
        button = QtGui.QPushButton(parent)
        button.setFlat(True)

        layout = QtGui.QVBoxLayout(button)
        layout.setAlignment(QtCore.Qt.AlignHCenter)
        layout.setSpacing(self.SPACING)
        layout.setContentsMargins(self.SPACING, self.SPACING, self.SPACING, self.SPACING)

        button.icon_label = QtGui.QLabel(button)
        button.icon_label.setAlignment(QtCore.Qt.AlignHCenter)
        button.layout().addWidget(button.icon_label, QtCore.Qt.AlignHCenter)

        button.text_label = QtGui.QLabel(parent)
        button.text_label.setWordWrap(True)
        button.text_label.setAlignment(QtCore.Qt.AlignHCenter)
        button.layout().addWidget(button.text_label, QtCore.Qt.AlignHCenter)

        button.setFocusPolicy(QtCore.Qt.NoFocus)

        return button
Пример #29
0
    def _create_overlay_parent_widget(self):
        """
        Creates a wiget with text, button and line edit to explain how the overlay works
        and showing how the overlay doesn't impact UI interaction when hidden.

        :returns: The widget who will own the overlay.
        """

        # setup a dummy widget to cover with the overlay
        my_label = QtGui.QLabel(
            "This is a label widget with an <tt>OverlayWidget</tt> "
            "parented to it. When shown,<br>the overlay will cover this label "
            "and display a message, error, or pixmap.<br><br><b>Click the "
            "buttons below to simulate calling the overlay's methods.<b>"
        )
        my_label.setWordWrap(True)
        my_label.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter)
        my_label.setStyleSheet("border: 1px solid palette(base);")

        layout = QtGui.QVBoxLayout()
        layout.addWidget(my_label)

        layout.addWidget(
            QtGui.QPushButton(
                "When the overlay widget is hidden, you should be able to click this button."
            )
        )

        edit = QtGui.QLineEdit()
        if edit.setPlaceholderText:
            edit.setPlaceholderText(
                "When the overlay widget is hidden, you should be able to enter text."
            )
        layout.addWidget(edit)

        parent_widget = QtGui.QWidget()
        parent_widget.setLayout(layout)

        return parent_widget
Пример #30
0
    def setupUi(self, MyTimeForm):
        MyTimeForm.setObjectName("MyTimeForm")
        MyTimeForm.resize(349, 367)
        self.verticalLayout = QtGui.QVBoxLayout(MyTimeForm)
        self.verticalLayout.setSpacing(4)
        self.verticalLayout.setContentsMargins(2, 6, 2, 2)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(2, -1, 2, 1)
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.addnew_btn = QtGui.QPushButton(MyTimeForm)
        self.addnew_btn.setObjectName("addnew_btn")
        self.horizontalLayout.addWidget(self.addnew_btn)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(1, -1, 1, -1)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(MyTimeForm)
        QtCore.QMetaObject.connectSlotsByName(MyTimeForm)