Пример #1
0
class HelpDialog(QDialog):
    def __init__(self, parent, help):
        QDialog.__init__(self, parent)
        self.setCaption(i18n("Package Manager Help"))
        self.layout = QGridLayout(self)
        self.htmlPart = KHTMLPart(self)
        self.resize(500,600)
        self.layout.addWidget(self.htmlPart.view(),1,1)

        if getKDELocale() == "tr":
            self.htmlPart.openURL(KURL(locate("data","package-manager/help/tr/%s" % help_files[help])))
        else:
            self.htmlPart.openURL(KURL(locate("data","package-manager/help/en/%s" % help_files[help])))
Пример #2
0
class HelpDialog(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self,parent)
        self.setCaption(i18n("PiSi X Help"))
        self.layout = QGridLayout(self)
        self.htmlPart = KHTMLPart(self)
        self.resize(500,600)
        self.layout.addWidget(self.htmlPart.view(),1,1)
        
        if os.environ['LANG'].startswith('tr_TR'):
            self.htmlPart.openURL(KURL(locate("data","pisix/help/tr/main_help.html")))
        else:
            self.htmlPart.openURL(KURL(locate("data","pisix/help/en/main_help.html")))
Пример #3
0
class HelpDialog(KDialog):
    def __init__(self, parent, help):
        KDialog.__init__(self, parent)
        self.setCaption(i18n("Package Manager Help"))
        self.layout = QGridLayout(self)
        self.htmlPart = KHTMLPart(self)
        self.resize(500,600)
        self.layout.addWidget(self.htmlPart.view(),1,1)

        locale = getKDELocale()

        if locale in ["tr", "es", "en", "fr", "nl", "de", "sv"]:
            self.htmlPart.openURL(KURL(locate("data","package-manager/help/%s/%s" % (locale, help_files[help]))))
        else:
            self.htmlPart.openURL(KURL(locate("data","package-manager/help/en/%s" % help_files[help])))
Пример #4
0
class HelpDialog(QDialog):
    def __init__(self, name, title, parent=None):
        QDialog.__init__(self, parent)
        self.setCaption(title)
        self.layout = QGridLayout(self)
        self.htmlPart = KHTMLPart(self)
        self.resize(500, 600)
        self.layout.addWidget(self.htmlPart.view(), 1, 1)

        lang = locale.setlocale(locale.LC_MESSAGES)
        if "_" in lang:
            lang = lang.split("_", 1)[0]
        url = locate("data", "%s/help/%s/main_help.html" % (name, lang))
        if not os.path.exists(url):
            url = locate("data", "%s/help/en/main_help.html" % name)
        self.htmlPart.openURL(KURL(url))
Пример #5
0
class HelpDialog(QDialog):
    def __init__(self, name, title, parent=None):
        QDialog.__init__(self, parent)
        self.setCaption(title)
        self.layout = QGridLayout(self)
        self.htmlPart = KHTMLPart(self)
        self.resize(500, 600)
        self.layout.addWidget(self.htmlPart.view(), 1, 1)

        lang = locale.setlocale(locale.LC_MESSAGES)
        if "_" in lang:
            lang = lang.split("_", 1)[0]
        url = locate("data", "%s/help/%s/main_help.html" % (name, lang))
        if not os.path.exists(url):
            url = locate("data", "%s/help/en/main_help.html" % name)
        self.htmlPart.openURL(KURL(url))
Пример #6
0
 def openURL(self, url):
     if not isinstance(url, KURL):
         url = KURL(url)
     return KHTMLPart.openURL(self, url)
Пример #7
0
	def goToURL(self, url):
		"""A hook (Qt signal slot actually) which is called to make
		make the browser navigate to a new URL.  By overriding
		this, we can do special things that normal browsers don't
		do, but that our application needs so that the browser is
		integrated with the rest of the app."""
	
		fullKURL = self.completeURL(url)
		url = unicode(fullKURL.url())

		if utils.isExternalURL(url):
			self.launchURLExternally(url)
			return

		if url[:4] == u'mms:':
			# just treat as http
			url = 'http:' + url[4:]
		
		self._considerForHistory(url)
		
		lowerurl = url.lower()
		
		if lowerurl == u'':
			return
		
		if lowerurl[:7] == u'mailto:':
			# special case; handle mailto urls, since they're used in the manual for contacting the author with bug reports etc.
			# FIXME: this probably isn't very secure
			self.launchURLExternally(lowerurl)
		elif lowerurl == u'katchtv:help:':
			self.goToURL(config.helpContents)
		elif lowerurl[:8] == u'katchtv:':
			self.handleCustomURL(url)
		else:
			isFeed, newUrl = utils.isAFeed(url)
			if isFeed:
				if self._window.bmarksList.haveChannel(newUrl):
					self._window.statusBar().message(u'Viewing Channel Feed' + url)
					self._writeFeed(newUrl)
				else:
					self._window.statusBar().message(u'Adding Channel Feed' + url)
					Feed.FeedCache.acquireLock()
					try:
						feed = Feed.FeedCache.getFeedFromURINoLock(newUrl)
					finally:
						Feed.FeedCache.releaseLock()
					
					feed.acquireLock()
					try:
						self._window.bmarksList.addChannel(feed)
					finally:
						feed.releaseLock()
			elif lowerurl[-5:] == '.html':
				# it's probably the manual, and should be viewable anyway, so
				# just show it
				self._window.statusBar().message(u'Loading URI ' + url)
				KHTMLPart.openURL(self, fullKURL)
			else:
				# before we load this, make sure it's going to be html-like, since
				# khtmlpart won't load other kparts for us
				mimetype = utils.mimetypeForHTTPURL(url)
				
				for ext in config.knownPlayableExtens:
					if lowerurl[-len(ext):] == ext:
						title = u"%s (direct download)" % url
						args = {
							Media.Item.URI: url,
							Media.Item.TITLE: url,
							Media.Item.DESCRIPTION: "This item was directly downloaded from a website, rather than through a subscribed channel's enclosed items.  No description is available; sorry."
						}
						mediaItem = Media.Item(args)
						self._writeDownload(mediaItem)
						return
				
				if not mimetype in config.knownHTMLMimetypes:
					self.launchURLExternally(url)
				else:
					self._window.statusBar().message(u'Loading URI ' + url)
					KHTMLPart.openURL(self, fullKURL)