Cleanup/Checks
This commit is contained in:
parent
bc6c97a672
commit
ae81427293
@ -21,9 +21,9 @@ def qurl(url):
|
|||||||
if not (re.match(r'^\w+://', url) or url.startswith('about:')):
|
if not (re.match(r'^\w+://', url) or url.startswith('about:')):
|
||||||
logging.debug("adding http:// to {}".format(url))
|
logging.debug("adding http:// to {}".format(url))
|
||||||
url = 'http://' + url
|
url = 'http://' + url
|
||||||
qurl = QUrl(url)
|
newurl = QUrl(url)
|
||||||
logging.debug('Converting {} to qurl -> {}'.format(url, qurl.url()))
|
logging.debug('Converting {} to qurl -> {}'.format(url, newurl.url()))
|
||||||
return qurl
|
return newurl
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
|
@ -65,7 +65,8 @@ class TabbedBrowser(TabWidget):
|
|||||||
self.setCurrentWidget(tab)
|
self.setCurrentWidget(tab)
|
||||||
tab.loadProgress.connect(self._filter_factory(self.cur_progress))
|
tab.loadProgress.connect(self._filter_factory(self.cur_progress))
|
||||||
tab.loadFinished.connect(self._filter_factory(self.cur_load_finished))
|
tab.loadFinished.connect(self._filter_factory(self.cur_load_finished))
|
||||||
tab.loadStarted.connect(self._clear_signal_cache)
|
tab.loadStarted.connect(lambda args:
|
||||||
|
self.sender().signal_cache.clear())
|
||||||
tab.loadStarted.connect(self._filter_factory(self.cur_load_started))
|
tab.loadStarted.connect(self._filter_factory(self.cur_load_started))
|
||||||
tab.statusBarMessage.connect(
|
tab.statusBarMessage.connect(
|
||||||
self._filter_factory(self.cur_statusbar_message))
|
self._filter_factory(self.cur_statusbar_message))
|
||||||
@ -319,9 +320,6 @@ class TabbedBrowser(TabWidget):
|
|||||||
"""Returns a partial functon calling _filter_signals with a signal."""
|
"""Returns a partial functon calling _filter_signals with a signal."""
|
||||||
return functools.partial(self._filter_signals, signal)
|
return functools.partial(self._filter_signals, signal)
|
||||||
|
|
||||||
def _clear_signal_cache(self, *args):
|
|
||||||
self.sender().signal_cache = OrderedDict()
|
|
||||||
|
|
||||||
def _filter_signals(self, signal, *args):
|
def _filter_signals(self, signal, *args):
|
||||||
"""Filter signals and trigger TabbedBrowser signals if the signal
|
"""Filter signals and trigger TabbedBrowser signals if the signal
|
||||||
was sent from the _current_ tab and not from any other one.
|
was sent from the _current_ tab and not from any other one.
|
||||||
@ -344,7 +342,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
dbgstr = "{} ({})".format(
|
dbgstr = "{} ({})".format(
|
||||||
signal.signal, ','.join([str(e) for e in args]))
|
signal.signal, ','.join([str(e) for e in args]))
|
||||||
sender = self.sender()
|
sender = self.sender()
|
||||||
if type(sender) != type(self.currentWidget()):
|
if not isinstance(sender, BrowserTab):
|
||||||
# FIXME why does this happen?
|
# FIXME why does this happen?
|
||||||
logging.warn('Got signal "{}" by {} which is no tab!'.format(
|
logging.warn('Got signal "{}" by {} which is no tab!'.format(
|
||||||
dbgstr, sender))
|
dbgstr, sender))
|
||||||
|
@ -11,7 +11,7 @@ import logging
|
|||||||
from PyQt5.QtWidgets import (QTreeView, QStyledItemDelegate, QStyle,
|
from PyQt5.QtWidgets import (QTreeView, QStyledItemDelegate, QStyle,
|
||||||
QStyleOptionViewItem, QSizePolicy)
|
QStyleOptionViewItem, QSizePolicy)
|
||||||
from PyQt5.QtCore import (QRectF, QRect, QPoint, pyqtSignal, Qt,
|
from PyQt5.QtCore import (QRectF, QRect, QPoint, pyqtSignal, Qt,
|
||||||
QItemSelectionModel, QSize)
|
QItemSelectionModel)
|
||||||
from PyQt5.QtGui import (QIcon, QPalette, QTextDocument, QTextOption,
|
from PyQt5.QtGui import (QIcon, QPalette, QTextDocument, QTextOption,
|
||||||
QTextCursor)
|
QTextCursor)
|
||||||
|
|
||||||
@ -195,7 +195,12 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
|||||||
painter = None
|
painter = None
|
||||||
|
|
||||||
def sizeHint(self, option, index):
|
def sizeHint(self, option, index):
|
||||||
value = index.data(Qt.SizeHintRole);
|
"""Overrides sizeHint of QStyledItemDelegate.
|
||||||
|
|
||||||
|
Returns the cell size based on the QTextDocument size, but might not
|
||||||
|
work correctly yet.
|
||||||
|
"""
|
||||||
|
value = index.data(Qt.SizeHintRole)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
return value
|
return value
|
||||||
self.opt = QStyleOptionViewItem(option)
|
self.opt = QStyleOptionViewItem(option)
|
||||||
|
Loading…
Reference in New Issue
Block a user