Sat, 12 Apr 2014 19:36:42 +0200
Fixed a window sizing issue.
# -*- coding: utf-8 -*- # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing a dialog to search foe template tags. """ from __future__ import unicode_literals # __IGNORE_WARNING__ from PyQt4.QtCore import pyqtSignal, pyqtSlot from PyQt4.QtGui import QDialog, QCompleter from .Ui_FindTemplateTagDialog import Ui_FindTemplateTagDialog class FindTemplateTagDialog(QDialog, Ui_FindTemplateTagDialog): """ Class implementing a dialog to search foe template tags. @signal tag(str) emitted to indicate to generate template text for the given tag name """ tag = pyqtSignal(str) def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget (QWidget) """ super(FindTemplateTagDialog, self).__init__(parent) self.setupUi(self) self.__completer = QCompleter(( # template tags 'autoescape', 'block', 'comment', 'csrf_token', 'cycle', 'debug', 'extendsvariable', 'extendsfile', 'filter', 'firstof', 'for', 'for...empty', 'if', 'ifchanged', 'ifequal', 'ifnotequal', 'includevariable', 'includefile', 'load', 'now', 'regroup', 'spaceless', 'ssi', 'ssifile', 'templatetag', 'url', 'urlas', 'verbatim', 'widthratio', 'with', # template filters 'add', 'addslashes', 'capfirst', 'center', 'cut', 'date', 'default', 'default_if_none', 'dictsort', 'dictsortreversed', 'divisibleby', 'escape', 'escapejs', 'filesizeformat', 'first', 'fix_ampersands', 'floatformat', 'force_escape', 'get_digit', 'iriencode', 'join', 'last', 'lenght', 'lenght_is', 'linebreaks', 'linebreaksbr', 'linenumbers', 'ljust', 'lower', 'make_list', 'phone2numeric', 'pluralize', 'pprint', 'random', 'removetags', 'rjust', 'safe', 'safeseq', 'slice', 'slugify', 'stringformat', 'striptags', 'time', 'timesince', 'timeuntil', 'title', 'truncatechars', 'truncatewords', 'truncatewords_html', 'unordered_list', 'upper', 'urlencode', 'urlize', 'urlizetrunc', 'wordcount', 'wordwrap', 'yesno', # humanize tags 'loadhumanize', 'apnumber', 'intcomma', 'intword', 'naturalday', 'naturaltime', 'ordinal', # web design tags 'loadweb', 'lorem', # static tags 'loadstatic', 'staticfile', 'staticvariable', 'get_static_prefix', 'get_media_prefix', # comments 'singlelinecommentselect', 'multilinecommentselect', 'singlelinecommentdialog', 'multilinecommentdialog', 'singlelinecommentclipboard', 'multilinecommentclipboard', 'multilinecommentfile', 'singlelinecommentdatetime', 'htmlcomment', 'iecomment', # internationalisation 'loadi18n', 'trans', 'trans..as', 'blocktrans', 'blocktrans..with', 'plural', 'language', 'get_current_language', 'get_available_languages', 'get_current_language_bidi', 'get_language_info', 'get_language_info_list', 'language_name', 'language_name_local', 'bidi', # localization 'loadl10n', 'localize_on', 'localize_off', 'localize', 'unlocalize', # timezone 'loadtz', 'localtime_on', 'localtime_off', 'timezone_set', 'timezone_unset', 'get_current_timezone', 'localtime', 'utc', 'timezone', ), self) self.__completer.setCompletionMode(QCompleter.PopupCompletion) self.__completer.setCaseSensitivity(False) self.tagEdit.setCompleter(self.__completer) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot() def on_tagEdit_returnPressed(self): """ Private slot handling the user pressing the return key. """ self.on_createButton_clicked() @pyqtSlot() def on_createButton_clicked(self): """ Private slot handling the user pressing the create button. """ tagName = self.tagEdit.text().lower().strip() if tagName: self.tag.emit(tagName)