SF.net SVN: fclient:[741] trunk/fclient/src/fclient/Ui_ViewBrowser.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-25 08:09:15
|
Revision: 741
http://fclient.svn.sourceforge.net/fclient/?rev=741&view=rev
Author: jUrner
Date: 2008-07-25 08:09:24 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
beatify
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewBrowser.py
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 08:06:56 UTC (rev 740)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 08:09:24 UTC (rev 741)
@@ -367,6 +367,29 @@
self.fcActions['ActionZoomIn'].setEnabled(tabWidget.count())
self.fcActions['ActionZoomOut'].setEnabled(tabWidget.count())
+ def _adjustTabText(self, qString):
+ maxTabText = self.fcSettings.value('MaxTabText')
+ minTabText = self.fcSettings.value('MinTabText')
+ ellipsis = self.trUtf8('..')
+
+ if minTabText < self.ForcedMinBrowserTabText:
+ minTabText = self.ForcedMinBrowserTabText
+ self.fcSettings.setValues(MinTabText=minTabText)
+ if maxTabText < self.ForcedMinBrowserTabText:
+ maxTabText = self.ForcedMinBrowserTabText
+ self.fcSettings.setValues(MaxTabText=maxTabText)
+ if minTabText > maxTabText:
+ minTabText = maxTabText
+ self.fcSettings.setValues(MinTabText=maxTabText)
+
+ if qString.count() < minTabText:
+ qString = qString.append('\x20' * (minTabText - qString.count()))
+ else:
+ if maxTabText < self.ForcedMinBrowserTabText:
+ maxTabText = sminTabText
+ qString = qtools.truncateString(maxTabText, qString, ellipsis)
+ return qString
+
def _downloadImageToDisk(self, hitTestResult):
px = hitTestResult.pixmap()
if px.isNull():
@@ -425,29 +448,6 @@
return True
return False
- def _adjustTabText(self, qString):
- maxTabText = self.fcSettings.value('MaxTabText')
- minTabText = self.fcSettings.value('MinTabText')
- ellipsis = self.trUtf8('..')
-
- if minTabText < self.ForcedMinBrowserTabText:
- minTabText = self.ForcedMinBrowserTabText
- self.fcSettings.setValues(MinTabText=minTabText)
- if maxTabText < self.ForcedMinBrowserTabText:
- maxTabText = self.ForcedMinBrowserTabText
- self.fcSettings.setValues(MaxTabText=maxTabText)
- if minTabText > maxTabText:
- minTabText = maxTabText
- self.fcSettings.setValues(MinTabText=maxTabText)
-
- if qString.count() < minTabText:
- qString = qString.append('\x20' * (minTabText - qString.count()))
- else:
- if maxTabText < self.ForcedMinBrowserTabText:
- maxTabText = sminTabText
- qString = qtools.truncateString(maxTabText, qString, ellipsis)
- return qString
-
#########################################
## methods
#########################################
@@ -459,6 +459,34 @@
tabWidget = self.controlById(self.IdTabBrowsers)
return tabWidget.currentWidget()
+ def load(self, url, force=False, browser=None):
+ """loads an url in the current browser. if there is no current browser, a new browser is created
+ @param force: (bool) if True, a new browser is opend if there is no browser available
+ @param browser: browser to load the url in or None to use the current browser
+ @return: (bool)
+ """
+ browser = self.currentBrowser() if browser is None else browser
+ tabWidget = self.controlById(self.IdTabBrowsers)
+ addressBar = self.controlById(self.IdEdAddressBar)
+ url = QtCore.QUrl(url)
+
+ # check if we have a browser at hand
+ if force and browser is None:
+ browser = self.newBrowser()
+ if browser is None:
+ return False
+
+ # load url
+ url.setScheme('http')
+ url.setHost(config.settings.value('FproxyConnectionHost'))
+ url.setPort(config.settings.value('FproxyConnectionPort'))
+ tabWidget.setTabText(tabWidget.indexOf(browser), self._adjustTabText(self.trUtf8('Loading')))
+ addressBar.setText(url.toString())
+ lastBrowserState = browser.userData()
+ lastBrowserState.url = url
+ browser.load(url)
+ return True
+
def newBrowser(self, title=''):
"""opens a browser in a new tab"""
tabWidget = self.controlById(self.IdTabBrowsers)
@@ -526,34 +554,6 @@
self.fcGlobalFeedback.setStatusMessage(lastBrowserState.statusMessage)
return browser
- def load(self, url, force=False, browser=None):
- """loads an url in the current browser. if there is no current browser, a new browser is created
- @param force: (bool) if True, a new browser is opend if there is no browser available
- @param browser: browser to load the url in or None to use the current browser
- @return: (bool)
- """
- browser = self.currentBrowser() if browser is None else browser
- tabWidget = self.controlById(self.IdTabBrowsers)
- addressBar = self.controlById(self.IdEdAddressBar)
- url = QtCore.QUrl(url)
-
- # check if we have a browser at hand
- if force and browser is None:
- browser = self.newBrowser()
- if browser is None:
- return False
-
- # load url
- url.setScheme('http')
- url.setHost(config.settings.value('FproxyConnectionHost'))
- url.setPort(config.settings.value('FproxyConnectionPort'))
- tabWidget.setTabText(tabWidget.indexOf(browser), self._adjustTabText(self.trUtf8('Loading')))
- addressBar.setText(url.toString())
- lastBrowserState = browser.userData()
- lastBrowserState.url = url
- browser.load(url)
- return True
-
#TODO: rework. we need more then one menu
def populateMenu(self, menu):
menu.addAction(self.fcActions['ActionGoToFProxy'])
@@ -568,15 +568,15 @@
#########################################
## overwritten events
#########################################
+ def closeEvent(self):
+ self.viewClose()
+
def hideEvent(self, event):
self.fcGlobalFeedback.setVisible(False)
def showEvent(self, event):
self.fcGlobalFeedback.setVisible(True)
- def closeEvent(self):
- self.viewClose()
-
def viewClose(self):
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|