Changeset db24cd4131c2…
Parent dce5f796a226…
by
Changes to 6 files · Browse files at db24cd4131c2 Showing diff from parent dce5f796a226 Diff from another changeset...
|
@@ -11,63 +11,80 @@ TortoiseHg About dialog - PyQt4 version
"""
+
import os, sys, urllib2
-from PyQt4.QtCore import PYQT_VERSION_STR, QT_VERSION_STR, Qt
-from PyQt4.QtGui import QPixmap, QDialog
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
from tortoisehg.hgqt.i18n import _
from tortoisehg.hgqt import qtlib
from tortoisehg.util import version, hglib, shlib, paths
-def make_version(tuple):
- vers = ".".join([str(x) for x in tuple])
- return vers
-
-try:
- from tortoisehg.hgqt.about_ui import Ui_AboutDialog
-except ImportError:
- from PyQt4 import uic
- Ui_AboutDialog = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'about.ui'))[0]
class AboutDialog(QDialog):
"""Dialog for showing info about TortoiseHg"""
- _upgradeurl = ''
-
def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent)
+
+ self.setWindowIcon(qtlib.geticon('thg_logo'))
+ self.setWindowTitle(_('About'))
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
- self._qui = Ui_AboutDialog()
- self._qui.setupUi(self)
+ self.vbox = QVBoxLayout()
+ self.vbox.setSpacing(8)
- self.setWindowIcon(qtlib.geticon('thg_logo'))
- self.setWindowTitle(_('About TortoiseHg'))
+ self.logo_lbl = QLabel()
+ self.logo_lbl.setMinimumSize(QSize(92, 50))
+ self.logo_lbl.setScaledContents(False)
+ self.logo_lbl.setAlignment(Qt.AlignCenter)
+ thglogofile = paths.get_tortoise_icon('thg_logo_92x50.png')
+ self.logo_lbl.setPixmap(QPixmap(thglogofile))
+ self.vbox.addWidget(self.logo_lbl)
- thglogofile = paths.get_tortoise_icon('thg_logo_92x50.png')
- self._qui.logo_label.setPixmap(QPixmap(thglogofile))
-
+ def make_version(tuple):
+ vers = ".".join([str(x) for x in tuple])
+ return vers
thgv = (_('version %s') % version.version())
libv = (_('with Mercurial-%s, Python-%s, PyQt-%s, Qt-%s') % \
(hglib.hgversion, make_version(sys.version_info[0:3]),
PYQT_VERSION_STR, QT_VERSION_STR))
- nvl = hglib.fromunicode(self._qui.name_version_libs_label.text())
- nvl = nvl.replace('*version_string*', thgv)
- nvl = nvl.replace('*libs_string*', libv)
- self._qui.name_version_libs_label.setText(nvl)
+ thgv = hglib.fromunicode(thgv)
+ libv = hglib.fromunicode(libv)
+ self.name_version_libs_lbl = QLabel()
+ par = ('<p style=\" margin-top:0px; margin-bottom:6px;\">'
+ '<span style=\"font-size:%spt; font-weight:600;\">'
+ '%s</span></p>')
+ name = (par % (14, 'TortoiseHg'))
+ thgv = (par % (10, thgv))
+ thgv = hglib.fromunicode(thgv)
+ nvl = _(''.join([name, thgv, libv]))
+ self.name_version_libs_lbl.setText(nvl)
+ self.name_version_libs_lbl.setAlignment(Qt.AlignCenter)
+ self.name_version_libs_lbl.setTextInteractionFlags(
+ Qt.TextSelectableByMouse)
+ self.vbox.addWidget(self.name_version_libs_lbl)
- self._qui.copyright_label.setText(_('Copyright 2008-2010 Steve Borho and others'))
- self._qui.courtesy_label.setText(
- _('Several icons are courtesy of the TortoiseSVN project'))
+ self.copyright_lbl = QLabel()
+ self.copyright_lbl.setAlignment(Qt.AlignCenter)
+ self.copyright_lbl.setText('\n'
+ + _('Copyright 2008-2010 Steve Borho and others'))
+ self.vbox.addWidget(self.copyright_lbl)
+ self.courtesy_lbl = QLabel()
+ self.courtesy_lbl.setAlignment(Qt.AlignCenter)
+ self.courtesy_lbl.setText(
+ _('Several icons are courtesy of the TortoiseSVN project' + '\n'))
+ self.vbox.addWidget(self.courtesy_lbl)
- _verurl = 'http://tortoisehg.bitbucket.org/curversion.txt'
+ verurl = 'http://tortoisehg.bitbucket.org/curversion.txt'
newver = (0,0,0)
- self._upgradeurl = 'http://tortoisehg.org'
+ self.site_url = 'http://tortoisehg.org'
+ self.upgradeurl = self.site_url
try:
- f = urllib2.urlopen(_verurl).read().splitlines()
+ f = urllib2.urlopen(verurl).read().splitlines()
newver = tuple([int(p) for p in f[0].split('.')])
- self._upgradeurl = f[1] # generic download URL
+ self.upgradeurl = f[1] # generic download URL
platform = sys.platform
if platform == 'win32':
from win32process import IsWow64Process as IsX64
@@ -76,7 +93,7 @@ for line in f[2:]:
p, url = line.split(':')
if platform == p:
- self._upgradeurl = url.strip()
+ self.upgradeurl = url.strip()
break
except:
pass
@@ -84,24 +101,57 @@ curver = tuple([int(p) for p in thgv.split('.')])
except:
curver = (0,0,0)
+ self.download_lbl = QLabel()
+ self.download_url_lbl = QLabel()
+ dlurl = ('<p style=\" margin-top:0px; margin-bottom:0px;\">'
+ '<a href=\"site-url--or--download-url\">'
+ '<span style=\" text-decoration: underline; color:#0000ff;\">'
+ '%s</span></a></p><p> </p>')
if newver > curver:
- self._qui.download_label.setText(
+ self.download_lbl.setText(
_('A new version of TortoiseHg is ready for download!'))
+ self.url = self.upgradeurl
else:
- self._qui.download_label.setText('')
- dlurl = hglib.fromunicode(self._qui.download_url_label.text())
- dlurl = dlurl.replace('http://thg-download-url', self._upgradeurl)
- self._qui.download_url_label.setText(dlurl)
+ self.download_lbl.setVisible(False)
+ self.url = self.site_url
+ dlurl = (dlurl % self.url)
+ self.download_url_lbl.setText(dlurl)
- self._qui.license_button.setText(_('&License'))
- self._qui.close_button.setText(_('&Close'))
+ self.download_lbl.setAlignment(Qt.AlignCenter)
+ self.download_url_lbl.setAlignment(Qt.AlignCenter)
+ self.download_url_lbl.setMouseTracking(True)
+ self.download_url_lbl.setAlignment(Qt.AlignCenter)
+ self.download_url_lbl.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
+ self.download_url_lbl.linkActivated.connect(self.visitTheSite)
+ self.vbox.addWidget(self.download_lbl)
+ self.vbox.addWidget(self.download_url_lbl)
- def actionVisitDownloadSite(self):
- shlib.browse_url(self._upgradeurl)
+ self.hbox = QHBoxLayout()
+ self.license_btn = QPushButton()
+ self.license_btn.setText(_('&License'))
+ self.license_btn.setAutoDefault(False)
+ self.license_btn.clicked.connect(self.showLicense)
+ self.hspacer = QSpacerItem(40, 20,
+ QSizePolicy.Expanding, QSizePolicy.Minimum)
+ self.close_btn = QPushButton()
+ self.close_btn.setText(_('&Close'))
+ self.close_btn.setDefault(True)
+ self.close_btn.clicked.connect(self.close)
+ self.hbox.addWidget(self.license_btn)
+ self.hbox.addItem(self.hspacer)
+ self.hbox.addWidget(self.close_btn)
+ self.vbox.addLayout(self.hbox)
- def actionShowLicense(self):
- from tortoisehg.hgqt import license
- ld = license.LicenseDialog(self)
+ self.setLayout(self.vbox)
+ self.layout().setSizeConstraint(QLayout.SetFixedSize)
+ self.setModal(True)
+
+ def visitTheSite(self):
+ shlib.browse_url(self.url)
+
+ def showLicense(self):
+ from tortoisehg.hgqt import license2
+ ld = license2.LicenseDialog(self)
ld.show()
|
|
|
@@ -1,305 +0,0 @@ - <?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AboutDialog</class>
- <widget class="QDialog" name="AboutDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>327</width>
- <height>343</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Dialog</string>
- </property>
- <property name="modal">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
- <property name="sizeConstraint">
- <enum>QLayout::SetFixedSize</enum>
- </property>
- <item>
- <layout class="QVBoxLayout" name="info_vlayout">
- <item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="logo_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>92</width>
- <height>50</height>
- </size>
- </property>
- <property name="text">
- <string>thg logo</string>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="name_version_libs_label">
- <property name="text">
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body>
-<p align="center" style=" margin-top:0px; margin-bottom:6px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">TortoiseHg</span></p>
-<p align="center" style=" margin-top:0px; margin-bottom:6px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">*version_string*</span></p>
-<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span>*libs_string*</span></p></body></html></string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_8">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="copyright_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Copyright 2008-2010 Steve Borho and others</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="courtesy_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Several icons are courtesy of the TortoiseSVN project</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_9">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="download_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>A new version of TortoiseHg is ready for download!</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="download_url_label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="mouseTracking">
- <bool>true</bool>
- </property>
- <property name="text">
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://thg_download_url"><span style=" text-decoration: underline; color:#0000ff;">http://thg-download-url</span></a></p></body></html></string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_10">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="button_hlayout">
- <item>
- <widget class="QPushButton" name="license_button">
- <property name="text">
- <string>&License</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="button_hspacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="close_button">
- <property name="text">
- <string>&Close</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- <action name="actionVisitDownloadSite">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>visitDownloadSite</string>
- </property>
- </action>
- <action name="actionShowLicense">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>showLicense</string>
- </property>
- </action>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>close_button</sender>
- <signal>clicked()</signal>
- <receiver>AboutDialog</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>261</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel">
- <x>242</x>
- <y>258</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>license_button</sender>
- <signal>clicked()</signal>
- <receiver>AboutDialog</receiver>
- <slot>actionShowLicense()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>49</x>
- <y>250</y>
- </hint>
- <hint type="destinationlabel">
- <x>92</x>
- <y>258</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>download_url_label</sender>
- <signal>linkActivated(QString)</signal>
- <receiver>AboutDialog</receiver>
- <slot>actionVisitDownloadSite()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>134</x>
- <y>208</y>
- </hint>
- <hint type="destinationlabel">
- <x>50</x>
- <y>219</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>actionShowLicense()</slot>
- <slot>actionVisitDownloadSite()</slot>
- </slots>
-</ui>
|
|
|
@@ -1,159 +0,0 @@ - # -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'tortoisehg/hgqt/about.ui'
-#
-# Created: Wed May 19 20:14:16 2010
-# by: PyQt4 UI code generator 4.7.3
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-class Ui_AboutDialog(object):
- def setupUi(self, AboutDialog):
- AboutDialog.setObjectName("AboutDialog")
- AboutDialog.resize(327, 343)
- AboutDialog.setModal(True)
- self.verticalLayout = QtGui.QVBoxLayout(AboutDialog)
- self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
- self.verticalLayout.setObjectName("verticalLayout")
- self.info_vlayout = QtGui.QVBoxLayout()
- self.info_vlayout.setObjectName("info_vlayout")
- self.label_5 = QtGui.QLabel(AboutDialog)
- self.label_5.setText("")
- self.label_5.setObjectName("label_5")
- self.info_vlayout.addWidget(self.label_5)
- self.logo_label = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.logo_label.sizePolicy().hasHeightForWidth())
- self.logo_label.setSizePolicy(sizePolicy)
- self.logo_label.setMinimumSize(QtCore.QSize(92, 50))
- self.logo_label.setScaledContents(False)
- self.logo_label.setAlignment(QtCore.Qt.AlignCenter)
- self.logo_label.setObjectName("logo_label")
- self.info_vlayout.addWidget(self.logo_label)
- self.label_6 = QtGui.QLabel(AboutDialog)
- self.label_6.setText("")
- self.label_6.setObjectName("label_6")
- self.info_vlayout.addWidget(self.label_6)
- self.name_version_libs_label = QtGui.QLabel(AboutDialog)
- self.name_version_libs_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
- self.name_version_libs_label.setObjectName("name_version_libs_label")
- self.info_vlayout.addWidget(self.name_version_libs_label)
- self.label_8 = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
- self.label_8.setSizePolicy(sizePolicy)
- self.label_8.setText("")
- self.label_8.setObjectName("label_8")
- self.info_vlayout.addWidget(self.label_8)
- self.copyright_label = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.copyright_label.sizePolicy().hasHeightForWidth())
- self.copyright_label.setSizePolicy(sizePolicy)
- self.copyright_label.setAlignment(QtCore.Qt.AlignCenter)
- self.copyright_label.setObjectName("copyright_label")
- self.info_vlayout.addWidget(self.copyright_label)
- self.courtesy_label = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.courtesy_label.sizePolicy().hasHeightForWidth())
- self.courtesy_label.setSizePolicy(sizePolicy)
- self.courtesy_label.setAlignment(QtCore.Qt.AlignCenter)
- self.courtesy_label.setObjectName("courtesy_label")
- self.info_vlayout.addWidget(self.courtesy_label)
- self.label_9 = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth())
- self.label_9.setSizePolicy(sizePolicy)
- self.label_9.setText("")
- self.label_9.setObjectName("label_9")
- self.info_vlayout.addWidget(self.label_9)
- self.download_label = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.download_label.sizePolicy().hasHeightForWidth())
- self.download_label.setSizePolicy(sizePolicy)
- self.download_label.setAlignment(QtCore.Qt.AlignCenter)
- self.download_label.setObjectName("download_label")
- self.info_vlayout.addWidget(self.download_label)
- self.download_url_label = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.download_url_label.sizePolicy().hasHeightForWidth())
- self.download_url_label.setSizePolicy(sizePolicy)
- self.download_url_label.setMouseTracking(True)
- self.download_url_label.setAlignment(QtCore.Qt.AlignCenter)
- self.download_url_label.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
- self.download_url_label.setObjectName("download_url_label")
- self.info_vlayout.addWidget(self.download_url_label)
- self.label_10 = QtGui.QLabel(AboutDialog)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
- self.label_10.setSizePolicy(sizePolicy)
- self.label_10.setText("")
- self.label_10.setObjectName("label_10")
- self.info_vlayout.addWidget(self.label_10)
- self.verticalLayout.addLayout(self.info_vlayout)
- self.button_hlayout = QtGui.QHBoxLayout()
- self.button_hlayout.setObjectName("button_hlayout")
- self.license_button = QtGui.QPushButton(AboutDialog)
- self.license_button.setAutoDefault(False)
- self.license_button.setObjectName("license_button")
- self.button_hlayout.addWidget(self.license_button)
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.button_hlayout.addItem(spacerItem)
- self.close_button = QtGui.QPushButton(AboutDialog)
- self.close_button.setDefault(True)
- self.close_button.setObjectName("close_button")
- self.button_hlayout.addWidget(self.close_button)
- self.verticalLayout.addLayout(self.button_hlayout)
- self.actionVisitDownloadSite = QtGui.QAction(AboutDialog)
- self.actionVisitDownloadSite.setCheckable(True)
- self.actionVisitDownloadSite.setObjectName("actionVisitDownloadSite")
- self.actionShowLicense = QtGui.QAction(AboutDialog)
- self.actionShowLicense.setCheckable(True)
- self.actionShowLicense.setObjectName("actionShowLicense")
-
- self.retranslateUi(AboutDialog)
- QtCore.QObject.connect(self.close_button, QtCore.SIGNAL("clicked()"), AboutDialog.close)
- QtCore.QObject.connect(self.license_button, QtCore.SIGNAL("clicked()"), AboutDialog.actionShowLicense)
- QtCore.QObject.connect(self.download_url_label, QtCore.SIGNAL("linkActivated(QString)"), AboutDialog.actionVisitDownloadSite)
- QtCore.QMetaObject.connectSlotsByName(AboutDialog)
-
- def retranslateUi(self, AboutDialog):
- AboutDialog.setWindowTitle(QtGui.QApplication.translate("AboutDialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
- self.logo_label.setText(QtGui.QApplication.translate("AboutDialog", "thg logo", None, QtGui.QApplication.UnicodeUTF8))
- self.name_version_libs_label.setText(QtGui.QApplication.translate("AboutDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
-"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
-"p, li { white-space: pre-wrap; }\n"
-"</style></head><body>\n"
-"<p align=\"center\" style=\" margin-top:0px; margin-bottom:6px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">TortoiseHg</span></p>\n"
-"<p align=\"center\" style=\" margin-top:0px; margin-bottom:6px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt; font-weight:600;\">*version_string*</span></p>\n"
-"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span>*libs_string*</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
- self.copyright_label.setText(QtGui.QApplication.translate("AboutDialog", "Copyright 2008-2010 Steve Borho and others", None, QtGui.QApplication.UnicodeUTF8))
- self.courtesy_label.setText(QtGui.QApplication.translate("AboutDialog", "Several icons are courtesy of the TortoiseSVN project", None, QtGui.QApplication.UnicodeUTF8))
- self.download_label.setText(QtGui.QApplication.translate("AboutDialog", "A new version of TortoiseHg is ready for download!", None, QtGui.QApplication.UnicodeUTF8))
- self.download_url_label.setText(QtGui.QApplication.translate("AboutDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
-"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
-"p, li { white-space: pre-wrap; }\n"
-"</style></head><body>\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://thg_download_url\"><span style=\" text-decoration: underline; color:#0000ff;\">http://thg-download-url</span></a></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
- self.license_button.setText(QtGui.QApplication.translate("AboutDialog", "&License", None, QtGui.QApplication.UnicodeUTF8))
- self.close_button.setText(QtGui.QApplication.translate("AboutDialog", "&Close", None, QtGui.QApplication.UnicodeUTF8))
- self.actionVisitDownloadSite.setText(QtGui.QApplication.translate("AboutDialog", "visitDownloadSite", None, QtGui.QApplication.UnicodeUTF8))
- self.actionShowLicense.setText(QtGui.QApplication.translate("AboutDialog", "showLicense", None, QtGui.QApplication.UnicodeUTF8))
-
|
@@ -11,33 +11,50 @@ TortoiseHg License dialog - PyQt4 version
"""
-from PyQt4.QtCore import Qt
-from PyQt4.QtGui import QDialog, QIcon, QPixmap
+
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
from tortoisehg.hgqt.i18n import _
+from tortoisehg.hgqt import qtlib
from tortoisehg.util import paths
-try:
- from tortoisehg.hgqt.license_ui import Ui_LicenseDialog
-except ImportError:
- from PyQt4 import uic
- Ui_LicenseDialog = uic.loadUiType(os.path.join(os.path.dirname(__file__),
- 'license.ui'))[0]
class LicenseDialog(QDialog):
"""Dialog for showing the TortoiseHg license"""
def __init__(self, parent=None):
super(LicenseDialog, self).__init__(parent)
+
+ self.setWindowIcon(qtlib.geticon('thg_logo'))
+ self.setWindowTitle(_('License'))
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
- self._qui = Ui_LicenseDialog()
- self._qui.setupUi(self)
- iconfile = paths.get_tortoise_icon('thg_logo.ico')
- icon = QIcon()
- icon.addPixmap(QPixmap(iconfile), QIcon.Normal, QIcon.Off)
- self.setWindowIcon(icon)
- self.setWindowTitle(_('License'))
+ self.resize(460, 360)
+
+ self.lic_txt = QPlainTextEdit()
+ self.lic_txt.setTextInteractionFlags(
+ Qt.TextSelectableByKeyboard|Qt.TextSelectableByMouse)
try:
lic = open(paths.get_license_path(), 'rb').read()
- self._qui.licenseText.setPlainText(lic)
+ self.lic_txt.setPlainText(lic)
except (IOError):
pass
+
+ self.hspacer = QSpacerItem(40, 20,
+ QSizePolicy.Expanding, QSizePolicy.Minimum)
+ self.close_btn = QPushButton(_('&Close'))
+ self.close_btn.clicked.connect(self.close)
+
+ self.hbox = QHBoxLayout()
+ self.hbox.addItem(self.hspacer)
+ self.hbox.addWidget(self.close_btn)
+ self.vbox = QVBoxLayout()
+ self.vbox.setSpacing(6)
+ self.vbox.addWidget(self.lic_txt)
+ self.vbox.addLayout(self.hbox)
+
+ self.setLayout(self.vbox)
+ self.setModal(True)
+
+
+def run(ui, *args, **opts):
+ return LicenseDialog()
|
|
|
@@ -1,111 +0,0 @@ - <?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <author>Johan Samyn <johan.samyn@gmail.com></author>
- <class>LicenseDialog</class>
- <widget class="QDialog" name="LicenseDialog">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>458</width>
- <height>360</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>License</string>
- </property>
- <property name="whatsThis">
- <string notr="true"/>
- </property>
- <property name="sizeGripEnabled">
- <bool>false</bool>
- </property>
- <property name="modal">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <item>
- <widget class="QPlainTextEdit" name="licenseText">
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="btnClose">
- <property name="text">
- <string>&Close</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- <action name="actionClose">
- <property name="text">
- <string>Close</string>
- </property>
- <property name="toolTip">
- <string>Close the License dialog</string>
- </property>
- </action>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>btnClose</sender>
- <signal>clicked()</signal>
- <receiver>LicenseDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>410</x>
- <y>338</y>
- </hint>
- <hint type="destinationlabel">
- <x>228</x>
- <y>179</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
|
|
@@ -1,55 +0,0 @@ - # -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'tortoisehg/hgqt/license.ui'
-#
-# Created: Mon May 17 22:22:10 2010
-# by: PyQt4 UI code generator 4.7.3
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-class Ui_LicenseDialog(object):
- def setupUi(self, LicenseDialog):
- LicenseDialog.setObjectName("LicenseDialog")
- LicenseDialog.setEnabled(True)
- LicenseDialog.resize(458, 360)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(LicenseDialog.sizePolicy().hasHeightForWidth())
- LicenseDialog.setSizePolicy(sizePolicy)
- LicenseDialog.setMaximumSize(QtCore.QSize(16777215, 16777215))
- LicenseDialog.setWhatsThis("None")
- LicenseDialog.setSizeGripEnabled(False)
- LicenseDialog.setModal(True)
- self.verticalLayout = QtGui.QVBoxLayout(LicenseDialog)
- self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
- self.verticalLayout.setObjectName("verticalLayout")
- self.licenseText = QtGui.QPlainTextEdit(LicenseDialog)
- self.licenseText.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
- self.licenseText.setObjectName("licenseText")
- self.verticalLayout.addWidget(self.licenseText)
- self.horizontalLayout = QtGui.QHBoxLayout()
- self.horizontalLayout.setContentsMargins(-1, -1, -1, 0)
- self.horizontalLayout.setObjectName("horizontalLayout")
- spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem)
- self.btnClose = QtGui.QPushButton(LicenseDialog)
- self.btnClose.setFlat(False)
- self.btnClose.setObjectName("btnClose")
- self.horizontalLayout.addWidget(self.btnClose)
- self.verticalLayout.addLayout(self.horizontalLayout)
- self.actionClose = QtGui.QAction(LicenseDialog)
- self.actionClose.setObjectName("actionClose")
-
- self.retranslateUi(LicenseDialog)
- QtCore.QObject.connect(self.btnClose, QtCore.SIGNAL("clicked()"), LicenseDialog.accept)
- QtCore.QMetaObject.connectSlotsByName(LicenseDialog)
-
- def retranslateUi(self, LicenseDialog):
- LicenseDialog.setWindowTitle(QtGui.QApplication.translate("LicenseDialog", "License", None, QtGui.QApplication.UnicodeUTF8))
- self.btnClose.setText(QtGui.QApplication.translate("LicenseDialog", "&Close", None, QtGui.QApplication.UnicodeUTF8))
- self.actionClose.setText(QtGui.QApplication.translate("LicenseDialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
- self.actionClose.setToolTip(QtGui.QApplication.translate("LicenseDialog", "Close the License dialog", None, QtGui.QApplication.UnicodeUTF8))
-
|
Loading...