Exemplo n.º 1
0
    def __init__(self, options, parent=None):
        QWizardPage.__init__(self, parent)

        # Variables
        self._options = options

        # Layouts
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        sublayout = self._initUI() # Initialize widgets
        sublayout.setContentsMargins(10, 10, 10, 10)
        layout.addLayout(sublayout, 1)
        layout.addStretch()

        self.setLayout(layout)
    def __init__(self, parent):
        super(TipOfTheDayDialog, self).__init__(parent)
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """

        ## qDebug("TipOfTheDayDialog constructor")

        self.mainWin = parent

        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWizardStyle(QWizard.ModernStyle)
        self.setMinimumSize(550, 400)

        ## self.setOption(QWizard.HaveHelpButton, True)

        page = QWizardPage(self)

        self.imgBanner = ImageWidget(self.mainWin.gImgDir, self.mainWin.gIconDir, self)

        # Read in the tips.txt file.
        # fileOpen = open(self.mainWin.gAppDir + os.sep + 'tips.txt')
        # tips = fileOpen.read()
        # fileOpen.close()
        # self.tipsList = [tip for tip in tips.split('\n') if tip] # remove the blank lines also.

        self.tipsList = [tip for tip in TIPS_TXT.split('\n') if tip] # remove the blank lines also.


        # Make sure we don't cause an IndexError.
        # DEV-We might be adding tips to the txt at runtime. The easy way to add and check tips.
        if int(self.mainWin.settings_general_current_tip) >= len(self.tipsList):
            self.mainWin.settings_general_current_tip = 0

        self.labelTipOfTheDay = QLabel(self)
        self.labelTipOfTheDay.setText(self.tipsList[int(self.mainWin.settings_general_current_tip)])
        self.labelTipOfTheDay.setWordWrap(True)

        # Forget about a standardish QCheckBox, real powerusers keep the lights on!
        self.lightswitch = LightSwitchWidget(self.mainWin.gImgDir, self.mainWin, self)

        self.showOnStartupLabel = QLabel(self)
        self.showOnStartupLabel.setText(self.tr('Show tips on startup'))

        layout = QVBoxLayout(self)
        hblayout = QHBoxLayout()
        hblayout2 = QHBoxLayout()
        hblayout.addStretch(1)
        hblayout.addWidget(self.imgBanner)
        hblayout.addStretch(1)
        layout.addLayout(hblayout)
        layout.addStrut(1)
        layout.addSpacerItem(QSpacerItem(0, 5))
        layout.addWidget(self.labelTipOfTheDay)
        layout.addStretch(1)
        hblayout2.addWidget(self.lightswitch)
        hblayout2.addWidget(self.showOnStartupLabel)
        hblayout2.addStretch(1)
        self.showOnStartupLabel.setAlignment(Qt.AlignBottom)

        layout.addLayout(hblayout2)
        page.setLayout(layout)
        self.addPage(page)

        self.setWindowTitle(self.tr('Tip of the Day'))

        buttonPrevious = QPushButton(self)
        buttonPrevious.setText(self.tr('&Previous'))
        buttonPrevious.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'undo.png'))
        buttonPrevious.setIconSize(QSize(24, 24))
        buttonNext = QPushButton(self)
        buttonNext.setText(self.tr('&Next'))
        buttonNext.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'redo.png'))
        buttonNext.setIconSize(QSize(24, 24))
        buttonClose = QPushButton(self)
        buttonClose.setText(self.tr('&Close'))
        buttonClose.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'windowclose.png'))
        buttonClose.setIconSize(QSize(24, 24))

        self.setButton(QWizard.CustomButton1, buttonPrevious)
        self.setButton(QWizard.CustomButton2, buttonNext)
        self.setButton(QWizard.CustomButton3, buttonClose)
        self.setOption(QWizard.HaveCustomButton1, True)
        self.setOption(QWizard.HaveCustomButton2, True)
        self.setOption(QWizard.HaveCustomButton3, True)
        self.customButtonClicked.connect(self.buttonTipOfTheDayClicked)

        listTipOfTheDayButtons = [QWizard.Stretch, QWizard.CustomButton1, QWizard.CustomButton2, QWizard.CustomButton3]
        self.setButtonLayout(listTipOfTheDayButtons)

        self.DoSetWhatsThis()
Exemplo n.º 3
0
 def __init__(self, gui, index, uiFileName, parent=None):
     QWizardPage.__init__(self, parent)
     ObsLightGuiObject.__init__(self, gui)
     self.index = index
     self.loadPageFromPyFile(uiFileName)
Exemplo n.º 4
0
 def __init__(self, parent=None):
     QWizardPage.__init__(self, parent)