Beispiel #1
0
def makeSplashLogo():
    '''Make a splash screen logo.'''

    splash = qt4.QSplashScreen()
    splash.setStyleSheet("background-color:whitesmoke;")

    # draw logo on pixmap
    layout = qt4.QVBoxLayout(splash)
    pm = utils.getPixmap('logo.png')
    logo = qt4.QLabel()
    logo.setPixmap(pm)
    logo.setAlignment(qt4.Qt.AlignCenter)
    layout.addWidget(logo)

    # add copyright text
    message = qt4.QLabel()
    message.setText(splashcopyr % utils.version())
    message.setAlignment(qt4.Qt.AlignCenter)
    # increase size of font
    font = message.font()
    font.setPointSize(font.pointSize() * 1.5)
    message.setFont(font)
    layout.addWidget(message)
    h = qt4.QFontMetrics(font).height()
    layout.setContentsMargins(h, h, h, h)

    # Center the spash screen
    splash.setGeometry(5, 5, 100, 100)
    screen = qt4.QDesktopWidget().screenGeometry()
    splash.move((screen.width() - layout.sizeHint().width()) / 2,
                (screen.height() - layout.sizeHint().height()) / 2)

    return splash
Beispiel #2
0
    def slotCurrentChanged(self, tab):
        """Lazy loading of tab when displayed."""
        if tab in self.tabinit:
            # already initialized
            return
        self.tabinit.add(tab)

        # settings to show
        subsetn = self.tabsubsetns[tab]
        # whether these are the main settings
        mainsettings = subsetn is self.setnsproxy

        # add this property list to the scroll widget for tab
        plist = PropertyList(self.document, showformatsettings=not mainsettings)
        plist.updateProperties(subsetn, title=(self.tabtitles[tab],
                                               self.tabtooltips[tab]),
                               onlyformatting=mainsettings)

        # create scrollable area
        scroll = qt4.QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(plist)

        # layout for tab widget
        layout = qt4.QVBoxLayout()
        layout.setMargin(2)
        layout.addWidget(scroll)

        # finally use layout containing items for tab
        self.widget(tab).setLayout(layout)
Beispiel #3
0
    def __init__(self, thedocument, *args):
        qt4.QDockWidget.__init__(self, *args)
        self.setWindowTitle(_("Console - Veusz"))
        self.setObjectName("veuszconsolewindow")

        # arrange sub-widgets in a vbox
        self.vbox = qt4.QWidget()
        self.setWidget(self.vbox)
        vlayout = qt4.QVBoxLayout(self.vbox)
        vlayout.setMargin(vlayout.margin() / 4)
        vlayout.setSpacing(vlayout.spacing() / 4)

        # start an interpreter instance to the document
        self.interpreter = document.CommandInterpreter(thedocument)
        self.document = thedocument
        # output from the interpreter goes to self.output_stdxxx

        self.con_stdout = _Writer(self.output_stdout)
        self.con_stderr = _Writer(self.output_stderr)

        self.interpreter.setOutputs(self.con_stdout, self.con_stderr)
        self.stdoutbuffer = ""
        self.stderrbuffer = ""

        # (mostly) hidden notification
        self._hiddennotify = qt4.QLabel()
        vlayout.addWidget(self._hiddennotify)
        self._hiddennotify.hide()

        # the output from the console goes here
        self._outputdisplay = qt4.QTextEdit()
        self._outputdisplay.setReadOnly(True)
        self._outputdisplay.insertHtml(introtext)
        vlayout.addWidget(self._outputdisplay)

        self._hbox = qt4.QWidget()
        hlayout = qt4.QHBoxLayout(self._hbox)
        hlayout.setMargin(0)
        vlayout.addWidget(self._hbox)

        self._prompt = qt4.QLabel(">>>")
        hlayout.addWidget(self._prompt)

        # where commands are typed in
        self._inputedit = _CommandEdit()
        hlayout.addWidget(self._inputedit)
        self._inputedit.setFocus()

        # keep track of multiple line commands
        self.command_build = ''

        # get called if enter is pressed in the input control
        self.connect(self._inputedit, qt4.SIGNAL("sigEnter"), self.slotEnter)
        # called if document logs something
        self.connect(thedocument, qt4.SIGNAL("sigLog"), self.slotDocumentLog)
Beispiel #4
0
    def __init__(self, document, mainwin, *args):
        qt4.QDockWidget.__init__(self, *args)
        self.setAttribute(qt4.Qt.WA_DeleteOnClose)
        self.setMinimumHeight(300)
        self.setWindowTitle('Tutorial - Veusz')
        self.setObjectName('veusztutorialwindow')

        self.setStyleSheet('background: lightyellow;')

        self.document = document
        self.mainwin = mainwin

        self.layout = l = qt4.QVBoxLayout()

        txtdoc = qt4.QTextDocument(self)
        txtdoc.setDefaultStyleSheet("p.usercmd { color: blue; } "
                                    "h1 { font-size: x-large;} "
                                    "code { color: green;} ")
        self.textedit = qt4.QTextEdit(readOnly=True)
        self.textedit.setDocument(txtdoc)

        l.addWidget(self.textedit)

        self.buttonbox = qt4.QDialogButtonBox()
        self.nextb = self.buttonbox.addButton('Next',
                                              qt4.QDialogButtonBox.ActionRole)
        self.connect(self.nextb, qt4.SIGNAL('clicked()'), self.slotNext)

        l.addWidget(self.buttonbox)

        # have to use a separate widget as dialog already has layout
        self.widget = qt4.QWidget()
        self.widget.setLayout(l)
        self.setWidget(self.widget)

        # timer for controlling flashing
        self.flashtimer = qt4.QTimer(self)
        self.connect(self.flashtimer, qt4.SIGNAL('timeout()'),
                     self.slotFlashTimeout)
        self.flash = self.oldflash = None
        self.flashon = False
        self.flashct = 0
        self.flashtimer.start(500)

        self.changeStep(StepIntro)
Beispiel #5
0
def makeSplash(app):
    '''Make a splash screen logo.'''

    splash = qt.QSplashScreen()
    splash.setStyleSheet("background-color:white; color: black;")

    # draw logo on pixmap
    layout = qt.QVBoxLayout(splash)
    logo = qt.QLabel()
    logo.setPixmap(utils.getPixmap('logo.png'))
    logo.setAlignment(qt.Qt.AlignCenter)
    layout.addWidget(logo)

    # add copyright text
    message = qt.QLabel()
    message.setText(splashcopyr % utils.version())
    message.setAlignment(qt.Qt.AlignCenter)
    # increase size of font
    font = message.font()
    font.setPointSizeF(font.pointSize()*1.5)
    message.setFont(font)
    layout.addWidget(message)
    h = qt.QFontMetrics(font).height()
    layout.setContentsMargins(h,h,h,h)

    # Center the spash screen
    splash.setGeometry(5, 5, 100, 100)
    screen = qt.QDesktopWidget().screenGeometry()
    splash.move(
        (screen.width()-layout.sizeHint().width())//2,
        (screen.height()-layout.sizeHint().height())//2
    )

    # make sure dialog goes away - avoid problem if a message box pops
    # up before it is removed
    qt.QTimer.singleShot(2000, splash.hide)

    return splash
Beispiel #6
0
    def __init__(self,
                 thedocument,
                 mainwin,
                 parent,
                 readonly=False,
                 filterdims=None,
                 filterdtype=None):
        """Initialise widget:
        thedocument: document to show
        mainwin: main window of application (or None if readonly)
        parent: parent of widget.
        readonly: for choosing datasets only
        filterdims: if set, only show datasets with dimensions given
        filterdtype: if set, only show datasets with type given
        """

        qt4.QWidget.__init__(self, parent)
        self.layout = qt4.QVBoxLayout()
        self.setLayout(self.layout)

        # options for navigator are in this layout
        self.optslayout = qt4.QHBoxLayout()

        # grouping options - use a menu to choose the grouping
        self.grpbutton = qt4.QPushButton(_("Group"))
        self.grpmenu = qt4.QMenu()
        self.grouping = setting.settingdb.get("navtree_grouping", "filename")
        self.grpact = qt4.QActionGroup(self)
        self.grpact.setExclusive(True)
        for name in self.grpnames:
            a = self.grpmenu.addAction(self.grpentries[name])
            a.grpname = name
            a.setCheckable(True)
            if name == self.grouping:
                a.setChecked(True)
            self.grpact.addAction(a)
        self.connect(self.grpact, qt4.SIGNAL("triggered(QAction*)"),
                     self.slotGrpChanged)
        self.grpbutton.setMenu(self.grpmenu)
        self.grpbutton.setToolTip(_("Group datasets with property given"))
        self.optslayout.addWidget(self.grpbutton)

        # filtering by entering text
        self.optslayout.addWidget(qt4.QLabel(_("Filter")))
        self.filteredit = LineEditWithClear()
        self.filteredit.setToolTip(_("Enter text here to filter datasets"))
        self.connect(self.filteredit,
                     qt4.SIGNAL("textChanged(const QString&)"),
                     self.slotFilterChanged)
        self.optslayout.addWidget(self.filteredit)

        self.layout.addLayout(self.optslayout)

        # the actual widget tree
        self.navtree = DatasetsNavigatorTree(thedocument,
                                             mainwin,
                                             self.grouping,
                                             None,
                                             readonly=readonly,
                                             filterdims=filterdims,
                                             filterdtype=filterdtype)
        self.layout.addWidget(self.navtree)