def version(ui, **opts): """output version and copyright information""" ui.write(_('TortoiseHg Dialogs (version %s), ' 'Mercurial (version %s)\n') % (thgversion.version(), hglib.hgversion)) if not ui.quiet: ui.write(shortlicense)
def get_error_text(self): if self.__error_text__ == None: text = '{{{\n#!python\n' # Wrap in Bitbucket wiki preformat markers text += _('** Please report this bug to ' 'http://bitbucket.org/tortoisehg/stable/issues\n') text += '** Mercurial version (%s). TortoiseHg version (%s)\n' % ( hglib.hgversion, version.version()) text += '** Command: %s\n' % (self.opts['cmd']) text += '** CWD: %s\n' % os.getcwd() extlist = [x[0] for x in extensions.extensions()] text += '** Extensions loaded: %s\n' % ', '.join(extlist) text += '** Python %s\n' % sys.version.replace('\n', '') if os.name == 'nt': text += '** sys.getwindowsversion(): %s\n' % str(sys.getwindowsversion()) arch = 'unknown (failed to import win32api)' try: import win32api arch = 'unknown' archval = win32api.GetNativeSystemInfo()[0] if archval == 9: arch = 'x64' elif archval == 0: arch = 'x86' except (ImportError, AttributeError): pass text += '** Processor architecture: %s\n' % arch text += self.opts['error'] text += '\n}}}' self.__error_text__ = text return self.__error_text__
def uFinished(self): newver = (0,0,0) try: f = self._newverreply.readAll().data().splitlines() self._newverreply.close() self._newverreply = None newver = tuple([int(p) for p in f[0].split('.')]) upgradeurl = f[1] # generic download URL platform = sys.platform if platform == 'win32': from win32process import IsWow64Process as IsX64 platform = IsX64() and 'x64' or 'x86' # linux2 for Linux, darwin for OSX for line in f[2:]: p, _url = line.split(':', 1) if platform == p: upgradeurl = _url.strip() break except (IndexError, ImportError, ValueError): pass try: thgv = version.version() if '+' in thgv: thgv = thgv[:thgv.index('+')] curver = tuple([int(p) for p in thgv.split('.')]) except ValueError: curver = (0,0,0) if newver > curver: url_lbl = _('A new version of TortoiseHg is ready for download!') urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl)) self.download_url_lbl.setText(urldata)
def uFinished(self): newver = (0, 0, 0) try: f = self._newverreply.readAll().data().splitlines() self._newverreply.close() self._newverreply = None newver = tuple([int(p) for p in f[0].split('.')]) upgradeurl = f[1] # generic download URL platform = sys.platform if platform == 'win32': from win32process import IsWow64Process as IsX64 platform = IsX64() and 'x64' or 'x86' # linux2 for Linux, darwin for OSX for line in f[2:]: p, _url = line.split(':', 1) if platform == p: upgradeurl = _url.strip() break except (IndexError, ImportError, ValueError): pass try: thgv = version.version() if '+' in thgv: thgv = thgv[:thgv.index('+')] curver = tuple([int(p) for p in thgv.split('.')]) except ValueError: curver = (0, 0, 0) if newver > curver: url_lbl = _('A new version of TortoiseHg is ready for download!') urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl)) self.download_url_lbl.setText(urldata)
def version(ui, **opts): """output version and copyright information""" ui.write( _('TortoiseHg Dialogs (version %s), ' 'Mercurial (version %s)\n') % (thgversion.version(), hglib.hgversion)) if not ui.quiet: ui.write(shortlicense)
def setfile(self, name): oname = name + '.old' try: rename(name, oname) except: pass self.file = posixfile(name, 'wb') self.msg('%s, Version %s' % (APP_TITLE, version.version())) self.msg('Logging to file started')
def getVersionInfo(self): 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)) 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)) nvl = ''.join([name, thgv, libv]) self.name_version_libs_lbl.setText(nvl)
def __call__(self, dlgfunc, ui, *args, **opts): portable_fork(ui, opts) if self._mainapp: self._opendialog(dlgfunc, ui, *args, **opts) return QSettings.setDefaultFormat(QSettings.IniFormat) self._mainapp = QApplication(sys.argv) self._gc = GarbageCollector(self, self.debug) try: # default org is used by QSettings self._mainapp.setApplicationName('TortoiseHgQt') self._mainapp.setOrganizationName('TortoiseHg') self._mainapp.setOrganizationDomain('tortoisehg.org') self._mainapp.setApplicationVersion(thgversion.version()) self._installtranslator() qtlib.setup_font_substitutions() qtlib.fix_application_font() qtlib.configstyles(ui) qtlib.initfontcache(ui) self._mainapp.setWindowIcon(qtlib.geticon('thg-logo')) if 'repository' in opts: try: # Ensure we can open the repository before opening any # dialog windows. Since thgrepo instances are cached, this # is not wasted. from tortoisehg.hgqt import thgrepo thgrepo.repository(ui, opts['repository']) except error.RepoError, e: qtlib.WarningMsgBox(_('Repository Error'), hglib.tounicode(str(e))) return dlg = dlgfunc(ui, *args, **opts) if dlg: dlg.show() dlg.raise_()
def __call__(self, dlgfunc, ui, *args, **opts): portable_fork(ui, opts) if self._mainapp: self._opendialog(dlgfunc, ui, *args, **opts) return QSettings.setDefaultFormat(QSettings.IniFormat) self._mainapp = QApplication(sys.argv) self._gc = GarbageCollector(self, self.debug) try: # default org is used by QSettings self._mainapp.setApplicationName('TortoiseHgQt') self._mainapp.setOrganizationName('TortoiseHg') self._mainapp.setOrganizationDomain('tortoisehg.org') self._mainapp.setApplicationVersion(thgversion.version()) self._installtranslator() qtlib.setup_font_substitutions() qtlib.fix_application_font() qtlib.configstyles(ui) qtlib.initfontcache(ui) self._mainapp.setWindowIcon(qtlib.geticon('thg-logo')) if 'repository' in opts: try: # Ensure we can open the repository before opening any # dialog windows. Since thgrepo instances are cached, this # is not wasted. from tortoisehg.hgqt import thgrepo thgrepo.repository(ui, opts['repository']) except error.RepoError, e: qtlib.WarningMsgBox(hglib.tounicode(_('Repository Error')), hglib.tounicode(str(e))) return dlg = dlgfunc(ui, *args, **opts) if dlg: dlg.show() dlg.raise_()
def __init__(self): super(AboutDialog, self).__init__() gtklib.set_tortoise_keys(self) lib_versions = ', '.join([ "Mercurial-%s" % hglib.hgversion, "Python-%s" % make_version(sys.version_info[0:3]), "PyGTK-%s" % make_version(gtk.pygtk_version), "GTK-%s" % make_version(gtk.gtk_version), ]) comment = _("Several icons are courtesy of the TortoiseSVN project") newver = (0,0,0) upgradeurl = 'http://tortoisehg.org' try: f = urllib2.urlopen(_verurl).read().splitlines() newver = tuple([int(p) for p in f[0].split('.')]) upgradeurl = f[1] # generic download URL platform = sys.platform if platform == 'win32': from win32process import IsWow64Process as IsX64 platform = IsX64() and 'x64' or 'x86' # linux2 for Linux, darwin for OSX for line in f[2:]: p, url = line.split(':') if platform == p: upgradeurl = url.strip() break except: pass ver = version.version() if '+' in ver: ver = ver[:ver.index('+')] try: curver = tuple([int(p) for p in ver.split('.')]) except: curver = (0,0,0) if newver > curver: comment = _('A new version of TortoiseHg is ready for download!') self.set_website(upgradeurl) else: self.set_website('http://tortoisehg.org') self.set_name("TortoiseHg") self.set_version(_("(version %s)") % version.version()) if hasattr(self, 'set_wrap_license'): self.set_wrap_license(False) self.set_copyright(_("Copyright 2008-2010 Steve Borho and others")) thg_logo = paths.get_tortoise_icon('thg_logo_92x50.png') thg_icon = paths.get_tortoise_icon('thg_logo.ico') try: license_file = paths.get_license_path() if license_file.endswith('.gz'): import gzip lic = gzip.open(license_file, 'rb').read() else: lic = open(license_file, 'rb').read() self.set_license(lic) except (ImportError, IOError): license = hgtk.shortlicense.splitlines()[1:] self.set_license('\n'.join(license)) self.set_comments(_("with %s") % lib_versions + "\n\n" + comment) if thg_logo: self.set_logo(gtk.gdk.pixbuf_new_from_file(thg_logo)) if thg_icon: self.set_icon_from_file(thg_icon) self.connect('response', self.response)