Beispiel #1
0
    def __init__(self, rolloutWidget, widget, title='Rollout', expanded=False):
        super(XRolloutItem, self).__init__(rolloutWidget)

        # initialize the interface
        self._rolloutWidget = rolloutWidget
        self._widget = widget
        self._expanded = expanded

        self._titleButton = QPushButton(self)
        self._titleButton.setFlat(True)
        self._titleButton.setSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Minimum)
        self._titleButton.setFixedHeight(20)
        self._titleButton.setText(title)
        self._titleButton.setStyleSheet(TITLE_STYLESHEET)

        layout = QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 9)
        layout.setSpacing(2)
        layout.addWidget(self._titleButton)
        layout.addWidget(widget)

        self.setLayout(layout)

        # initialize the expanded state
        self.setExpanded(expanded)

        # create connections
        self._titleButton.clicked.connect(self.toggleExpanded)
 def __init__( self, parent, plugin ):
     super(PluginWidget, self).__init__(parent)
     
     self._icon = QLabel(self)
     pixmap = QPixmap(plugin.iconFile())
     if pixmap.isNull():
         pixmap = QPixmap(projexui.resources.find('img/plugin_48.png'))
     self._icon.setPixmap(pixmap)
     self._icon.setMinimumWidth(48)
     self._icon.setMinimumHeight(48)
     self._icon.setAlignment(Qt.AlignCenter)
     
     self._title = QLabel(plugin.title(), self)
     self._title.setAlignment(Qt.AlignCenter)
     
     font = self.font()
     font.setPointSize(7)
     
     self._title.setFont(font)
     
     vbox = QVBoxLayout()
     vbox.addStretch()
     vbox.addWidget(self._icon)
     vbox.addWidget(self._title)
     vbox.addStretch()
     
     self.setLayout(vbox)
     
     self._plugin = plugin
Beispiel #3
0
 def __init__( self, rolloutWidget, widget, title = 'Rollout', expanded = False ):
     super(XRolloutItem, self).__init__(rolloutWidget)
     
     # initialize the interface
     self._rolloutWidget = rolloutWidget
     self._widget        = widget
     self._expanded      = expanded
     
     self._titleButton   = QPushButton(self)
     self._titleButton.setFlat(True)
     self._titleButton.setSizePolicy(QSizePolicy.Expanding, 
                                     QSizePolicy.Minimum)
     self._titleButton.setFixedHeight(20)
     self._titleButton.setText(title)
     self._titleButton.setStyleSheet(TITLE_STYLESHEET)
     
     layout = QVBoxLayout()
     layout.setContentsMargins(6, 6, 6, 9)
     layout.setSpacing(2)
     layout.addWidget(self._titleButton)
     layout.addWidget(widget)
     
     self.setLayout(layout)
     
     # initialize the expanded state
     self.setExpanded(expanded)
     
     # create connections
     self._titleButton.clicked.connect( self.toggleExpanded )
 def edit( parent, template, actions = None ):
     """
     Prompts the user to edit the menu template with the given actions. \
     If no actions are supplied, then the actions from the parent will \
     be used.
     
     :param      parent   | <QWidget>
                 template | <str>
                 actions  | {<str> name: <QAction>, .. } || None
     
     :return     (<str> template, <bool> accepted)
     """
     # collect the potential actions from the widget
     if ( actions is None ):
         actions = {}
         for action in parent.actions():
             key = nativestring(action.objectName())
             if ( not key ):
                 key = nativestring(action.text()).replace('&', '')
             
             if ( key ):
                 actions[key] = action
     
     if ( not actions ):
         return ('', False)
     
     dlg = QDialog(parent)
     dlg.setWindowTitle('Edit Menu')
     
     widget = XMenuTemplateWidget(dlg)
     widget.setActions(actions)
     widget.setMenuTemplate(template)
     widget.layout().setContentsMargins(0, 0, 0, 0)
     
     opts = QDialogButtonBox.Save | QDialogButtonBox.Cancel
     btns = QDialogButtonBox(opts, Qt.Horizontal, dlg)
     
     btns.accepted.connect( dlg.accept )
     btns.rejected.connect( dlg.reject )
     
     layout = QVBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     dlg.resize(650, 400)
     
     if ( dlg.exec_() ):
         return (widget.menuTemplate(), True)
     return ('', False)
    def __init__(self, parent=None):
        super(XQueryBuilderWidget, self).__init__(parent)

        # load the user interface
        projexui.loadUi(__file__, self)

        self.setMinimumWidth(470)

        # define custom properties
        self._rules = {}
        self._defaultQuery = []
        self._completionTerms = []
        self._minimumCount = 1

        # set default properties
        self._container = QWidget(self)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)
        layout.addStretch(1)
        self._container.setLayout(layout)
        self.uiQueryAREA.setWidget(self._container)

        # create connections
        self.uiResetBTN.clicked.connect(self.emitResetRequested)
        self.uiSaveBTN.clicked.connect(self.emitSaveRequested)
        self.uiCancelBTN.clicked.connect(self.emitCancelRequested)

        self.resetRequested.connect(self.reset)
Beispiel #6
0
    def getText(cls,
                parent=None,
                windowTitle='Get Text',
                label='',
                text='',
                plain=True,
                wrapped=True):
        """
        Prompts the user for a text entry using the text edit class.
        
        :param      parent | <QWidget>
                    windowTitle | <str>
                    label       | <str>
                    text        | <str>
                    plain       | <bool> | return plain text or not
        
        :return     (<str> text, <bool> accepted)
        """
        # create the dialog
        dlg = QDialog(parent)
        dlg.setWindowTitle(windowTitle)

        # create the layout
        layout = QVBoxLayout()

        # create the label
        if label:
            lbl = QLabel(dlg)
            lbl.setText(label)
            layout.addWidget(lbl)

        # create the widget
        widget = cls(dlg)
        widget.setText(text)

        if not wrapped:
            widget.setLineWrapMode(XTextEdit.NoWrap)

        layout.addWidget(widget)

        # create the buttons
        btns = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                                Qt.Horizontal, dlg)
        layout.addWidget(btns)

        dlg.setLayout(layout)
        dlg.adjustSize()

        # create connections
        btns.accepted.connect(dlg.accept)
        btns.rejected.connect(dlg.reject)

        if dlg.exec_():
            if plain:
                return (widget.toPlainText(), True)
            else:
                return (widget.toHtml(), True)
        else:
            return ('', False)
 def __init__(self, parent=None):
     super(XOrbQuickFilterWidget, self).__init__(parent)
     
     # define custom properties
     self._tableType = None
     self._plugins = []
     self._filterFormat = ''
     self._pluginFactory = XOrbQueryPluginFactory()
     
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 3, 0, 3)
     self.setLayout(layout)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     
     self.customContextMenuRequested.connect(self.showMenu)
    def __init__(self, parent=None):
        super(XOrbQuickFilterWidget, self).__init__(parent)

        # define custom properties
        self._tableType = None
        self._plugins = []
        self._filterFormat = ''
        self._pluginFactory = XOrbQueryPluginFactory()

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 3, 0, 3)
        self.setLayout(layout)
        self.setContextMenuPolicy(Qt.CustomContextMenu)

        self.customContextMenuRequested.connect(self.showMenu)
Beispiel #9
0
 def __init__( self, parent=None, viewTypes=None):
     super(XViewDialog, self).__init__(parent)
     
     # create a new view widget for this dialog
     self._viewWidget = XViewWidget(self)
     if viewTypes != None:
         self._viewWidget.setViewTypes(viewTypes)
     
     # create the layout
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.addWidget(self._viewWidget)
     
     self.setLayout(layout)
     self.setWindowTitle('Detached Views')
     self.setAttribute(Qt.WA_DeleteOnClose)
 def __init__( self, parent = None ):
     super(XQueryBuilderWidget, self).__init__( parent )
     
     # load the user interface
     projexui.loadUi(__file__, self)
     
     self.setMinimumWidth(470)
     
     # define custom properties
     self._rules           = {}
     self._defaultQuery    = []
     self._completionTerms = []
     self._minimumCount    = 1
     
     # set default properties
     self._container = QWidget(self)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(2)
     layout.addStretch(1)
     self._container.setLayout(layout)
     self.uiQueryAREA.setWidget(self._container)
     
     # create connections
     self.uiResetBTN.clicked.connect(  self.emitResetRequested )
     self.uiSaveBTN.clicked.connect(   self.emitSaveRequested )
     self.uiCancelBTN.clicked.connect( self.emitCancelRequested )
     
     self.resetRequested.connect(      self.reset )
Beispiel #11
0
 def getText(cls,
             parent=None,
             windowTitle='Get Text',
             label='',
             text='',
             plain=True,
             wrapped=True):
     """
     Prompts the user for a text entry using the text edit class.
     
     :param      parent | <QWidget>
                 windowTitle | <str>
                 label       | <str>
                 text        | <str>
                 plain       | <bool> | return plain text or not
     
     :return     (<str> text, <bool> accepted)
     """
     # create the dialog
     dlg = QDialog(parent)
     dlg.setWindowTitle(windowTitle)
     
     # create the layout
     layout = QVBoxLayout()
     
     # create the label
     if label:
         lbl = QLabel(dlg)
         lbl.setText(label)
         layout.addWidget(lbl)
     
     # create the widget
     widget = cls(dlg)
     widget.setText(text)
     
     if not wrapped:
         widget.setLineWrapMode(XTextEdit.NoWrap)
     
     layout.addWidget(widget)
     
     # create the buttons
     btns = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                             Qt.Horizontal,
                             dlg)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     
     # create connections
     btns.accepted.connect(dlg.accept)
     btns.rejected.connect(dlg.reject)
     
     if dlg.exec_():
         if plain:
             return (widget.toPlainText(), True)
         else:
             return (widget.toHtml(), True)
     else:
         return ('', False)
Beispiel #12
0
 def __init__( self, parent = None ):
     super(XKeyValueDialog, self).__init__(parent)
     
     # create the interface
     self._keyEdit   = XLineEdit(self)
     self._keyEdit.setMaximumWidth(80)
     self._keyEdit.setHint( 'set key' )
     
     self._valueEdit = XLineEdit(self)
     self._valueEdit.setHint( 'set value' )
     
     hbox = QHBoxLayout()
     hbox.addWidget(self._keyEdit)
     hbox.addWidget(self._valueEdit)
     
     opts    = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
     buttons = QDialogButtonBox( opts, Qt.Horizontal, self )
     
     vbox = QVBoxLayout()
     vbox.addLayout(hbox)
     vbox.addWidget(buttons)
     
     # update the look and size
     self.setLayout(vbox)
     self.setWindowTitle('Edit Pair')
     self.setMinimumWidth(350)
     self.adjustSize()
     self.setFixedHeight(self.height())
     
     # create connections
     buttons.accepted.connect( self.accept )
     buttons.rejected.connect( self.reject )
Beispiel #13
0
    def __init__(self, parent=None):
        super(XRolloutWidget, self).__init__(parent)

        # define custom properties
        self.setWidgetResizable(True)

        # set default properties
        widget = QWidget(self)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(3)
        layout.addStretch(1)
        widget.setLayout(layout)

        self.setWidget(widget)
 def __init__( self, parent = None ):
     super(XOrbQueryContainer, self).__init__( parent )
     
     # load the user interface
     projexui.loadUi(__file__, self)
     
     # define custom properties
     self._queryWidget   = parent
     self._entryWidget   = QWidget(self)
     self._currentJoiner = QueryCompound.Op.And
     
     layout = QVBoxLayout()
     layout.addStretch(1)
     layout.setSpacing(3)
     self._entryWidget.setLayout(layout)
     self.uiQueryAREA.setWidget(self._entryWidget)
     
     # set default properties
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     
     # create connections (use old-style syntax or PySide errors)
     self.connect(self.uiBackBTN, SIGNAL('clicked()'), self.exitCompound)
     self.entriesUpdated.connect(self.refreshEntries)
Beispiel #15
0
 def __init__( self, parent, uifile = '' ):
     uifile = ''
     
     super(XSchemeConfigWidget, self).__init__(parent, uifile)
     
     # define the font widgets
     self._applicationFont     = QFontComboBox(self)
     self._applicationFont.setProperty('dataName', wrapVariant('font'))
     self._applicationFont.setSizePolicy( QSizePolicy.Expanding,
                                          QSizePolicy.Preferred )
                                        
     self._applicationFontSize = QSpinBox(self)
     self._applicationFontSize.setProperty('dataName', wrapVariant('fontSize'))
     
     self._colorButton = XColorButton(self)
     
     hbox = QHBoxLayout()
     hbox.addWidget(QLabel('Font:', self))
     hbox.addWidget(self._applicationFont)
     hbox.addWidget(QLabel('Size:', self))
     hbox.addWidget(self._applicationFontSize)
     hbox.addWidget(QLabel('Quick Color:', self))
     hbox.addWidget(self._colorButton)
     
     # define the color tree
     self._colorTree = XColorTreeWidget(self)
     self._colorTree.setProperty('dataName', wrapVariant('colorSet'))
     
     vbox = QVBoxLayout()
     vbox.addLayout(hbox)
     vbox.addWidget(self._colorTree)
     
     self.setLayout(vbox)
     
     # create connections
     self._colorButton.colorChanged.connect( self._colorTree.setQuickColor )
Beispiel #16
0
 def __init__( self, parent = None ):
     super(XRolloutWidget, self).__init__( parent )
     
     # define custom properties
     self.setWidgetResizable(True)
     
     # set default properties
     widget = QWidget(self)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(3)
     layout.addStretch(1)
     widget.setLayout(layout)
     
     self.setWidget(widget)
Beispiel #17
0
 def getDialog(cls, name, parent=None):
     """
     Generates a dialog for this class widget and returns it.
     
     :param      parent | <QtGui.QWidget> || None
     
     :return     <QtGui.QDialog>
     """
     key = '_{0}__{1}_dialog'.format(cls.__name__, name)
     dlgref = getattr(cls, key, None)
     
     if dlgref is not None:
         dlg = dlgref()
         if dlg:
             return dlg
         
     if parent is None:
         parent = QApplication.activeWindow()
     
     dlg = QDialog(parent)
     
     # create widget
     widget = cls(dlg)
     dlg.__dict__['_mainwidget'] = widget
     widget.layout().setContentsMargins(0, 0, 0, 0)
     
     # create buttons
     opts    = QDialogButtonBox.Save | QDialogButtonBox.Cancel
     buttons = QDialogButtonBox(opts, Qt.Horizontal, dlg)
     
     # create layout
     layout = QVBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(buttons)
     dlg.setLayout(layout)
     dlg.resize(widget.minimumSize() + QSize(15, 15))
     widget.resizeRequested.connect(dlg.adjustSize)
     
     # create connections
     buttons.accepted.connect(widget.save)
     buttons.rejected.connect(dlg.reject)
     widget.saved.connect(dlg.accept)
     widget.setFocus()
     
     dlg.adjustSize()
     if parent and parent.window():
         center = parent.window().geometry().center()
         dlg.move(center.x() - dlg.width() / 2.0,
                  center.y() - dlg.height() / 2.0)
     
     setattr(cls, key, weakref.ref(dlg))
     return dlg
Beispiel #18
0
 def edit( cls, record, parent = None, uifile = '', commit = True ):
     """
     Prompts the user to edit the inputed record.
     
     :param      record | <orb.Table>
                 parent | <QWidget>
     
     :return     <bool> | accepted
     """
     # create the dialog
     dlg = QDialog(parent)
     dlg.setWindowTitle('Edit %s' % record.schema().name())
     
     # create the widget
     cls    = record.schema().property('widgetClass', cls)
     
     widget = cls(dlg)
     
     if ( uifile ):
         widget.setUiFile(uifile)
     
     widget.setRecord(record)
     widget.layout().setContentsMargins(0, 0, 0, 0)
     
     # create buttons
     opts = QDialogButtonBox.Save | QDialogButtonBox.Cancel
     btns = QDialogButtonBox(opts, Qt.Horizontal, dlg)
     
     # create layout
     layout = QVBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     
     # create connections
     #btns.accepted.connect(widget.save)
     btns.rejected.connect(dlg.reject)
     widget.saved.connect(dlg.accept)
     
     if ( dlg.exec_() ):
         if commit:
             result = widget.record().commit()
             if 'errored' in result:
                 QMessageBox.information(self.window(),
                                         'Error Committing to Database',
                                         result['errored'])
                 return False
         return True
     return False
Beispiel #19
0
    def edit(parent, template, actions=None):
        """
        Prompts the user to edit the menu template with the given actions. \
        If no actions are supplied, then the actions from the parent will \
        be used.
        
        :param      parent   | <QWidget>
                    template | <str>
                    actions  | {<str> name: <QAction>, .. } || None
        
        :return     (<str> template, <bool> accepted)
        """
        # collect the potential actions from the widget
        if (actions is None):
            actions = {}
            for action in parent.actions():
                key = nativestring(action.objectName())
                if (not key):
                    key = nativestring(action.text()).replace('&', '')

                if (key):
                    actions[key] = action

        if (not actions):
            return ('', False)

        dlg = QDialog(parent)
        dlg.setWindowTitle('Edit Menu')

        widget = XMenuTemplateWidget(dlg)
        widget.setActions(actions)
        widget.setMenuTemplate(template)
        widget.layout().setContentsMargins(0, 0, 0, 0)

        opts = QDialogButtonBox.Save | QDialogButtonBox.Cancel
        btns = QDialogButtonBox(opts, Qt.Horizontal, dlg)

        btns.accepted.connect(dlg.accept)
        btns.rejected.connect(dlg.reject)

        layout = QVBoxLayout()
        layout.addWidget(widget)
        layout.addWidget(btns)

        dlg.setLayout(layout)
        dlg.adjustSize()
        dlg.resize(650, 400)

        if (dlg.exec_()):
            return (widget.menuTemplate(), True)
        return ('', False)
Beispiel #20
0
    def __init__(self, parent=None, viewTypes=None):
        super(XViewDialog, self).__init__(parent)

        # create a new view widget for this dialog
        self._viewWidget = XViewWidget(self)
        if viewTypes != None:
            self._viewWidget.setViewTypes(viewTypes)

        # create the layout
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._viewWidget)

        self.setLayout(layout)
        self.setWindowTitle('Detached Views')
        self.setAttribute(Qt.WA_DeleteOnClose)
Beispiel #21
0
 def create( cls, model, parent = None, uifile = '', commit = True ):
     """
     Prompts the user to create a new record for the inputed table.
     
     :param      model   | <subclass of orb.Table>
                 parent  | <QWidget>
     
     :return     <orb.Table> || None/ | instance of the inputed table class
     """
     # create the dialog
     dlg = QDialog(parent)
     dlg.setWindowTitle('Create %s' % model.schema().name())
     
     # create the widget
     cls    = model.schema().property('widgetClass', cls)
     widget = cls(dlg)
     
     if ( uifile ):
         widget.setUiFile(uifile)
     
     widget.setModel(model)
     widget.layout().setContentsMargins(0, 0, 0, 0)
     
     # create buttons
     opts = QDialogButtonBox.Save | QDialogButtonBox.Cancel
     btns = QDialogButtonBox(opts, Qt.Horizontal, dlg)
     
     # create layout
     layout = QVBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     
     # create connections
     btns.accepted.connect(widget.save)
     btns.rejected.connect(dlg.reject)
     widget.saved.connect(dlg.accept)
     
     if ( dlg.exec_() ):
         record = widget.record()
         if ( commit ):
             record.commit()
         return record
     return None
Beispiel #22
0
 def getPlainText( parent, title, caption, text = '' ):
     """
     Prompts the user for more advanced text input.
     
     :param      parent  | <QWidget> || None
                 title   | <str>
                 caption | <str>
                 text    | <str>
     
     :return     (<str>, <bool> accepted)
     """
     dlg = QDialog(parent)
     dlg.setWindowTitle(title)
     
     label = QLabel(dlg)
     label.setText(caption)
     
     edit = QTextEdit(dlg)
     edit.setText(text)
     edit.selectAll()
     
     opts = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
     btns = QDialogButtonBox(opts, Qt.Horizontal, dlg)
     
     btns.accepted.connect(dlg.accept)
     btns.rejected.connect(dlg.reject)
     
     layout = QVBoxLayout()
     layout.addWidget(label)
     layout.addWidget(edit)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     
     if ( dlg.exec_() ):
         return (edit.toPlainText(), True)
     return ('', False)
Beispiel #23
0
    def __init__(self, parent=None):
        super(XOrbQueryContainer, self).__init__(parent)

        # load the user interface
        projexui.loadUi(__file__, self)

        # define custom properties
        self._queryWidget = parent
        self._entryWidget = QWidget(self)
        self._currentJoiner = QueryCompound.Op.And

        layout = QVBoxLayout()
        layout.addStretch(1)
        layout.setSpacing(3)
        self._entryWidget.setLayout(layout)
        self.uiQueryAREA.setWidget(self._entryWidget)

        # set default properties
        self.setContextMenuPolicy(Qt.CustomContextMenu)

        # create connections (use old-style syntax or PySide errors)
        self.connect(self.uiBackBTN, SIGNAL('clicked()'), self.exitCompound)
        self.entriesUpdated.connect(self.refreshEntries)
Beispiel #24
0
    def __init__(self, parent, uifile=''):
        uifile = ''

        super(XSchemeConfigWidget, self).__init__(parent, uifile)

        # define the font widgets
        self._applicationFont = QFontComboBox(self)
        self._applicationFont.setProperty('dataName', wrapVariant('font'))
        self._applicationFont.setSizePolicy(QSizePolicy.Expanding,
                                            QSizePolicy.Preferred)

        self._applicationFontSize = QSpinBox(self)
        self._applicationFontSize.setProperty('dataName',
                                              wrapVariant('fontSize'))

        self._colorButton = XColorButton(self)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel('Font:', self))
        hbox.addWidget(self._applicationFont)
        hbox.addWidget(QLabel('Size:', self))
        hbox.addWidget(self._applicationFontSize)
        hbox.addWidget(QLabel('Quick Color:', self))
        hbox.addWidget(self._colorButton)

        # define the color tree
        self._colorTree = XColorTreeWidget(self)
        self._colorTree.setProperty('dataName', wrapVariant('colorSet'))

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addWidget(self._colorTree)

        self.setLayout(vbox)

        # create connections
        self._colorButton.colorChanged.connect(self._colorTree.setQuickColor)
Beispiel #25
0
 def __init__( self, parent = None, style='gray' ):
     super(XLoaderWidget, self).__init__( parent )
     
     # define properties
     self._currentMode       = None
     self._showSubProgress   = False
     
     self.setAttribute(Qt.WA_DeleteOnClose)
     
     # udpate the palette
     palette = self.palette()
     
     if style == 'white':
         palette.setColor( palette.Window, QColor(255, 255, 255, 180) )
     else:
         palette.setColor( palette.Window, QColor( 80, 80, 80, 180 ) )
     
     palette.setColor( palette.Base, Qt.gray )
     palette.setColor( palette.AlternateBase, Qt.lightGray )
     palette.setColor( palette.WindowText, Qt.gray )
     self.setPalette(palette)
     
     # create the movie label
     self._movieLabel = QLabel(self)
     self._movieLabel.setAlignment(Qt.AlignCenter)
     self._movieLabel.setMovie(XLoaderWidget.getMovie())
     self._movieLabel.setPalette(palette)
     
     self._smallMovieLabel = QLabel(self)
     self._smallMovieLabel.setAlignment(Qt.AlignCenter)
     self._smallMovieLabel.setMovie(XLoaderWidget.getMovie())
     self._smallMovieLabel.setPalette(palette)
     self._smallMovieLabel.hide()
     
     # create text label
     self._messageLabel = QLabel(self)
     self._messageLabel.setAlignment(Qt.AlignCenter)
     self._messageLabel.setText('Loading...')
     self._messageLabel.setPalette(palette)
     
     # create primary progress bar
     self._primaryProgressBar    = XLoaderProgressBar(self)
     self._subProgressBar        = XLoaderProgressBar(self)
     
     self._primaryProgressBar.setPalette(palette)
     self._subProgressBar.setPalette(palette)
     
     # create the loader widget
     self._loaderFrame = QFrame(self)
     self._loaderFrame.setFrameShape(QFrame.Box)
     self._loaderFrame.setAutoFillBackground(True)
     self._loaderFrame.setFixedWidth(160)
     self._loaderFrame.setFixedHeight(60)
     
     if style == 'white':
         palette.setColor(palette.Window, QColor('white'))
     else:
         palette.setColor(palette.Window, QColor(85, 85, 85))
     self._loaderFrame.setPalette(palette)
     
     layout = QVBoxLayout()
     layout.addWidget(self._movieLabel)
     layout.addWidget(self._primaryProgressBar)
     layout.addWidget(self._subProgressBar)
     layout.addStretch()
     layout.addWidget(self._messageLabel)
     self._loaderFrame.setLayout(layout)
     
     # set default properties
     self.setAutoFillBackground(True)
     
     # layout the controls
     layout = QVBoxLayout()
     layout.addStretch(1)
     layout.addWidget(self._loaderFrame)
     layout.addWidget(self._smallMovieLabel)
     layout.addStretch(1)
     
     hlayout = QHBoxLayout()
     hlayout.addStretch(1)
     hlayout.addLayout(layout)
     hlayout.addStretch(1)
     
     self.setLayout(hlayout)
     self.setCurrentMode(XLoaderWidget.Mode.Spinner)
Beispiel #26
0
 def __init__(self, parent=None, buttons=None):
     super(XPopupWidget, self).__init__(parent)
     
     # define custom properties
     self._anchor                = XPopupWidget.Anchor.TopCenter
     self._autoCalculateAnchor   = False
     self._autoCloseOnAccept     = True
     self._autoCloseOnReject     = True
     self._autoCloseOnFocusOut   = False
     self._autoDefault           = True
     self._first                 = True
     self._animated              = False
     self._currentMode           = None
     self._positionLinkedTo      = []
     self._possibleAnchors       = XPopupWidget.Anchor.all()
     
     # define controls
     self._result        = 0
     self._resizable     = True
     self._popupPadding  = 10
     self._titleBarVisible = True
     self._buttonBoxVisible = True
     self._dialogButton  = QToolButton(self)
     self._closeButton   = QToolButton(self)
     self._scrollArea    = QScrollArea(self)
     self._sizeGrip      = QSizeGrip(self)
     self._sizeGrip.setFixedWidth(12)
     self._sizeGrip.setFixedHeight(12)
     
     self._leftSizeGrip  = QSizeGrip(self)
     self._leftSizeGrip.setFixedWidth(12)
     self._leftSizeGrip.setFixedHeight(12)
     
     if buttons is None:
         buttons = QDialogButtonBox.NoButton
     
     self._buttonBox     = QDialogButtonBox(buttons, Qt.Horizontal, self)
     self._buttonBox.setContentsMargins(3, 0, 3, 9)
     
     self._scrollArea.setWidgetResizable(True)
     self._scrollArea.setFrameShape(QScrollArea.NoFrame)
     self._scrollArea.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Expanding)
     
     palette = self.palette()
     self._scrollArea.setPalette(palette)
     
     self._dialogButton.setToolTip('Popout to Dialog')
     self._closeButton.setToolTip('Close Popup')
     
     for btn in (self._dialogButton, self._closeButton):
         btn.setAutoRaise(True)
         btn.setIconSize(QSize(14, 14))
         btn.setMaximumSize(16, 16)
     
     # setup the icons
     icon = QIcon(projexui.resources.find('img/dialog.png'))
     self._dialogButton.setIcon(icon)
     
     icon = QIcon(projexui.resources.find('img/close.png'))
     self._closeButton.setIcon(icon)
     
     # define the ui
     hlayout = QHBoxLayout()
     hlayout.setSpacing(0)
     hlayout.addStretch(1)
     hlayout.addWidget(self._dialogButton)
     hlayout.addWidget(self._closeButton)
     hlayout.setContentsMargins(0, 0, 0, 0)
     
     hlayout2 = QHBoxLayout()
     hlayout2.addWidget(self._buttonBox)
     hlayout2.setContentsMargins(0, 0, 3, 0)
     
     vlayout = QVBoxLayout()
     vlayout.addLayout(hlayout)
     vlayout.addWidget(self._scrollArea)
     vlayout.addLayout(hlayout2)
     vlayout.setContentsMargins(3, 2, 3, 2)
     vlayout.setSpacing(0)
     
     self.setLayout(vlayout)
     self.setPositionLinkedTo(parent)
     
     # set default properties
     self.setAutoFillBackground(True)
     self.setBackgroundRole(QPalette.Window)
     self.setWindowTitle('Popup')
     self.setFocusPolicy(Qt.StrongFocus)
     self.setCurrentMode(XPopupWidget.Mode.Popup)
     
     # create connections
     self._dialogButton.clicked.connect(self.setDialogMode)
     self._closeButton.clicked.connect(self.reject)
     self._buttonBox.accepted.connect(self.accept)
     self._buttonBox.rejected.connect(self.reject)
     self._buttonBox.clicked.connect(self.handleButtonClick)
Beispiel #27
0
    def __init__(self, parent=None, buttons=None):
        super(XPopupWidget, self).__init__(parent)

        # define custom properties
        self._anchor = XPopupWidget.Anchor.TopCenter
        self._autoCalculateAnchor = False
        self._autoCloseOnAccept = True
        self._autoCloseOnReject = True
        self._autoCloseOnFocusOut = False
        self._autoDefault = True
        self._first = True
        self._animated = False
        self._currentMode = None
        self._positionLinkedTo = []
        self._possibleAnchors = XPopupWidget.Anchor.all()

        # define controls
        self._result = 0
        self._resizable = True
        self._popupPadding = 10
        self._titleBarVisible = True
        self._buttonBoxVisible = True
        self._dialogButton = QToolButton(self)
        self._closeButton = QToolButton(self)
        self._scrollArea = QScrollArea(self)
        self._sizeGrip = QSizeGrip(self)
        self._sizeGrip.setFixedWidth(12)
        self._sizeGrip.setFixedHeight(12)

        self._leftSizeGrip = QSizeGrip(self)
        self._leftSizeGrip.setFixedWidth(12)
        self._leftSizeGrip.setFixedHeight(12)

        if buttons is None:
            buttons = QDialogButtonBox.NoButton

        self._buttonBox = QDialogButtonBox(buttons, Qt.Horizontal, self)
        self._buttonBox.setContentsMargins(3, 0, 3, 9)

        self._scrollArea.setWidgetResizable(True)
        self._scrollArea.setFrameShape(QScrollArea.NoFrame)
        self._scrollArea.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Expanding)

        palette = self.palette()
        self._scrollArea.setPalette(palette)

        self._dialogButton.setToolTip('Popout to Dialog')
        self._closeButton.setToolTip('Close Popup')

        for btn in (self._dialogButton, self._closeButton):
            btn.setAutoRaise(True)
            btn.setIconSize(QSize(14, 14))
            btn.setMaximumSize(16, 16)

        # setup the icons
        icon = QIcon(projexui.resources.find('img/dialog.png'))
        self._dialogButton.setIcon(icon)

        icon = QIcon(projexui.resources.find('img/close.png'))
        self._closeButton.setIcon(icon)

        # define the ui
        hlayout = QHBoxLayout()
        hlayout.setSpacing(0)
        hlayout.addStretch(1)
        hlayout.addWidget(self._dialogButton)
        hlayout.addWidget(self._closeButton)
        hlayout.setContentsMargins(0, 0, 0, 0)

        hlayout2 = QHBoxLayout()
        hlayout2.addWidget(self._buttonBox)
        hlayout2.setContentsMargins(0, 0, 3, 0)

        vlayout = QVBoxLayout()
        vlayout.addLayout(hlayout)
        vlayout.addWidget(self._scrollArea)
        vlayout.addLayout(hlayout2)
        vlayout.setContentsMargins(3, 2, 3, 2)
        vlayout.setSpacing(0)

        self.setLayout(vlayout)
        self.setPositionLinkedTo(parent)

        # set default properties
        self.setAutoFillBackground(True)
        self.setBackgroundRole(QPalette.Window)
        self.setWindowTitle('Popup')
        self.setFocusPolicy(Qt.StrongFocus)
        self.setCurrentMode(XPopupWidget.Mode.Popup)

        # create connections
        self._dialogButton.clicked.connect(self.setDialogMode)
        self._closeButton.clicked.connect(self.reject)
        self._buttonBox.accepted.connect(self.accept)
        self._buttonBox.rejected.connect(self.reject)
        self._buttonBox.clicked.connect(self.handleButtonClick)