コード例 #1
0
 def get_splashscreen(self):
     """:return: a :class:`PyQt4.QtGui.QPixmap` to be used as splash screen"""
     from camelot.view.art import Pixmap
     qpm = Pixmap('splashscreen.png').getQPixmap()
     img = qpm.toImage()
     # support transparency
     if not qpm.mask(): 
         if img.hasAlphaBuffer(): bm = img.createAlphaMask() 
         else: bm = img.createHeuristicMask() 
         qpm.setMask(bm) 
     return qpm
コード例 #2
0
    def __init__(self, parent=None, model=None, collection_getter=None):
        from camelot.view.controls.editors import NoteEditor
        super(DataPreviewPage, self).__init__(parent)
        assert model
        assert collection_getter
        self.setTitle(_('Data Preview'))
        self.setSubTitle(_('Please review the data below.'))
        self._complete = False
        self.model = model
        validator = self.model.get_validator()
        validator.validity_changed_signal.connect(self.update_complete)
        model.layoutChanged.connect(self.validate_all_rows)
        post(validator.validate_all_rows)
        self.collection_getter = collection_getter

        icon = 'tango/32x32/mimetypes/x-office-spreadsheet.png'
        self.setPixmap(QtGui.QWizard.LogoPixmap, Pixmap(icon).getQPixmap())

        self.previewtable = One2ManyEditor(
            admin=model.get_admin(),
            parent=self,
            create_inline=True,
            vertical_header_clickable=False,
        )
        self._note = NoteEditor()
        self._note.set_value(None)

        ly = QtGui.QVBoxLayout()
        ly.addWidget(self.previewtable)
        ly.addWidget(self._note)
        self.setLayout(ly)

        self.setCommitPage(True)
        self.setButtonText(QtGui.QWizard.CommitButton, _('Import'))
        self.update_complete()
コード例 #3
0
    def __init__(self, pixmap=None, hover_pixmap=None, parent=None):
        super(CloseMark, self).__init__(parent)

        DEFAULT_PIXMAP = Pixmap('close_mark.png').getQPixmap()
        DEFAULT_HOVER_PIXMAP = Pixmap('close_mark_hover.png').getQPixmap()

        self._pixmap = pixmap or DEFAULT_PIXMAP
        self._hover_pixmap = hover_pixmap or DEFAULT_HOVER_PIXMAP

        self.setPixmap(self._pixmap)

        # move to top right corner
        width = self.pixmap().width()
        height = self.pixmap().height()
        parent_width = self.parentItem().boundingRect().width()
        self.setPos(-width / 2 + parent_width, -height / 2)

        self.setAcceptsHoverEvents(True)
        # stays on top of other items
        self.setZValue(10)
コード例 #4
0
 def __init__(self, parent=None, model=None, admin=None):
     """
     :model: the source model from which to import data
     :admin: the admin class of the target data
     """
     super(FinalPage, self).__init__(parent)
     self.model = model
     self.admin = admin
     icon = 'tango/32x32/mimetypes/x-office-spreadsheet.png'
     self.setPixmap(QtGui.QWizard.LogoPixmap, Pixmap(icon).getQPixmap())
     self.setButtonText(QtGui.QWizard.FinishButton, _('Close'))
     self.progressbar = QtGui.QProgressBar()
コード例 #5
0
 def get_splashscreen(self):
     """:return: a :class:`PyQt4.QtGui.QPixmap` to be used as splash screen"""
     from camelot.view.art import Pixmap
     qpm = Pixmap('splashscreen.png').getQPixmap()
     img = qpm.toImage()
     # support transparency
     if not qpm.mask(): 
         if img.hasAlphaBuffer(): bm = img.createAlphaMask() 
         else: bm = img.createHeuristicMask() 
         qpm.setMask(bm) 
     return qpm
コード例 #6
0
#  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
#  DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
#  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
#  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#  ============================================================================

from ...core.qt import QtCore, QtGui, QtWidgets, Qt
from camelot.view.art import Pixmap
from camelot.view.model_thread import get_model_thread

working_pixmap = Pixmap('tango/32x32/animations/process-working.png')


class BusyWidget(QtWidgets.QLabel):
    """A widget indicating the application is performing some background task.
    The widget acts as an overlay of its parent widget and displays animating
    orbs"""
    def __init__(self, parent=None):
        super(BusyWidget, self).__init__(parent)
        palette = QtGui.QPalette(self.palette())
        palette.setColor(palette.Background, Qt.transparent)
        self.setPalette(palette)
        self.setAttribute(Qt.WA_TransparentForMouseEvents)
        pixmap = working_pixmap.getQPixmap()
        rows = 4
        self.cols = 8