def __init__(self, parent):
     KHTMLPart.__init__(self, parent, 'TestTextBrowser')
     self.current = 'filenew.png'
     self.setDocument()
     # KHTMLPart is QObject, not QWidget
     # need to put parent (splitter) here
     self.splitter = parent
 def __init__(self, parent, name='AbandonPart'):
     KHTMLPart.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.doc  = AbandoniaInfoDocument(self.app)
     self.handler = AbandonGamesHandler(self.app)
     self.begin()
     self.write('')
     self.end()
Beispiel #3
0
	def __init__(self, parentWidget, window):
		"""Initialises a new KTVHTMLPart object.  Requires the same
		arguments as KHTMLPart, plus the parent window it will attach to."""
		KHTMLPart.__init__(self, parentWidget)
		self._window = window
		
		QObject.connect(self.browserExtension(), SIGNAL('openURLRequestDelayed(const KURL&, const KParts::URLArgs&)'), self._openURLRequest)
		
		self.__lastURL = None
		self.__currentURL = None
		self.setFormNotification(self.NoNotification)
 def __init__(self, parent, name='InfoPart'):
     KHTMLPart.__init__(self, parent, name)
     self._init_common()
     # we need to make a parent for the dialogs
     # the KHTMLPart does not work for this as it
     # is derived from QObject and not QWidget
     self._widget = QWidget(None, 'dialog_parent')
     self.dialog_parent = self._widget
     # start a blank page
     self.begin()
     self.write('')
     self.end()
Beispiel #5
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])))
Beispiel #6
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")))
Beispiel #7
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])))
Beispiel #8
0
    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))
Beispiel #9
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))
Beispiel #10
0
 def _setPreviewWidget(parent):
     parent.sourcePreview.hide()  # hide default
     parent.vp = KHTMLPart(parent.Preview, "HTMLPart",
                           parent.Preview)  #create
     parent.sourcePreview = parent.vp.view()  # re-route
     parent.Preview.layout().addWidget(
         parent.sourcePreview)  # show new
 def openURL(self, url):
     if not isinstance(url, KURL):
         url = KURL(url)
     return KHTMLPart.openURL(self, url)
 def __init__(self, parent, name='BaseInfoPart'):
     KHTMLPart.__init__(self, parent, name)
     HasDialogs.__init__(self)
     self.app = get_application_pointer()
     self.dialog_parent = QWidget(self.parent(), 'dialog_parent')
Beispiel #13
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)