Пример #1
0
    def __init__(self, parent):
        QtGui.QWidget.__init__(self)

        cur_year = str(datetime.date.today().year)
        copy_right = "©"
        motto = 'Easy Linux from the Source.<br>'
        help_text = '%s v%s. \n' %(parent.ClientObj.Name, \
                parent.ClientObj.Version) + \
                _('Makes part of Calculate Utilities 3.0.0') + '<br>' + \
                _('Company') + ' Calculate %s 2007-%s' %(copy_right,cur_year)

        html_help = ("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN' "
                  "'http://www.w3.org/TR/REC-html40/strict.dtd'>"
                  "<html><head><style type=text/css>"
                  "</style></head><body>" + help_text + "</body></html>")

        helpLabel = LabelWordWrap(html_help, self)
        helpLabel.setContentsMargins(10,10,10,5)
        company_name = _('Company website')
        company_site = 'http://www.calculate.ru'
        distr_name = _('Distribution website')
        distr_site = 'http://www.calculate-linux.org'
        linkLabel = LabelWordWrap(company_name + \
                ": <br><a href='http://www.calculate.ru'>" + \
                company_site + "</a><br><br>" + distr_name+ \
                ": <br><a href='http://www.calculate-linux.org'>" + \
                distr_site + "</a>", self)

        linkLabel.setContentsMargins(10,5,10,5)
        linkLabel.setOpenExternalLinks(True)
        helpQuit = QtGui.QPushButton(_("Close"), self)
        helpQuit.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
        helpQuit.setFixedWidth(100)

        self.image_lbl = QtGui.QLabel(self)

        filename = '/usr/share/icons/Calculate/128x128/apps/' \
                   'calculate-console.png'
        ir = QtGui.QImageReader(filename)

        diff = ir.size().width() / 140.0
        w = ir.size().width() / diff
        h = ir.size().height() / diff
        if w > 2 * h:
            ir.setScaledSize(QtCore.QSize(1.7 * w, 1.7 * h))
        else:
            ir.setScaledSize(QtCore.QSize(w, h))
        img = ir.read()
        pm2 = QtGui.QPixmap().fromImage(img)

        self.image_lbl.setPixmap(pm2)

        layout = QtGui.QGridLayout(self)
        layout.setContentsMargins(24,10,24,10)
        layout.setAlignment(QtCore.Qt.AlignTop)

        layout.addWidget(self.image_lbl, 0,0,3,1)
        layout.addWidget(helpLabel,0,1)
        layout.addWidget(linkLabel,1,1)
        layout.addWidget(helpQuit,2,1, QtCore.Qt.AlignRight)
        self.setLayout(layout)
        helpQuit.clicked.connect(self.close)

#        self.setFixedSize(400 + x ,200)
        self.setFixedSize(self.sizeHint().width() + 50, \
                          self.sizeHint().height())
        self.setWindowTitle (_('Calculate Console '))
        help_icon = QtGui.QIcon \
                        ('/usr/share/pixmaps/calculate-console-online.png')
        if help_icon.isNull():
            help_icon = QtGui.QIcon.fromTheme("help-about")
        self.setWindowIcon (help_icon)

        self.move(parent.window().geometry().x() + \
                  parent.window().geometry().width() / 2 \
                  - self.size().width() / 2, \
                  parent.window().geometry().y() + \
                  parent.window().geometry().height() / 2 \
                  - self.size().height() / 2)

        # for clear memory after closed this window
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)