Sun, 16 Feb 2014 13:18:57 +0100
Finished the implementation and corrected some code style issues.
--- a/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Wed Feb 12 19:54:24 2014 +0100 +++ b/ProjectDjangoTagsMenu/DjangoTagsMenuHandler.py Sun Feb 16 13:18:57 2014 +0100 @@ -66,7 +66,7 @@ mainMenu.addMenu(self.__initStaticMenu()) mainMenu.addMenu(self.__initCommentsMenu()) mainMenu.addMenu(self.__initInternationalizationMenu()) - mainMenu.addMenu(self.__initlocalizationMenu()) + mainMenu.addMenu(self.__initLocalizationMenu()) mainMenu.addMenu(self.__initTimezoneMenu()) def __initTagsMenu(self): @@ -588,7 +588,7 @@ self.__internationalizationMenu = mainMenu return mainMenu - def __initlocalizationMenu(self): + def __initLocalizationMenu(self): """ Private method to initialize the static menu. @@ -1543,12 +1543,12 @@ elif tag == "localtime_on": templateText = ( '{{% localtime on %}}{0}{{% endlocaltime %}}'.format( - selectedText)) + selectedText)) replace = True elif tag == "localtime_off": templateText = ( '{{% localtime off %}}{0}{{% endlocaltime %}}'.format( - selectedText)) + selectedText)) replace = True elif tag == "timezone_set": from .TimezoneSelectionDialog import TimezoneSelectionDialog @@ -1556,12 +1556,12 @@ if ok: templateText = ( '{{% timezone "{0}" %}}{1}{{% endtimezone %}}'.format( - timezone, selectedText)) + timezone, selectedText)) replace = True elif tag == "timezone_unset": templateText = ( '{{% timezone None %}}{0}{{% endlocaltime %}}'.format( - selectedText)) + selectedText)) replace = True elif tag == "get_current_timezone": templateText = '{% get_current_timezone as TIME_ZONE %}'
--- a/ProjectDjangoTagsMenu/FindTemplateTagDialog.py Wed Feb 12 19:54:24 2014 +0100 +++ b/ProjectDjangoTagsMenu/FindTemplateTagDialog.py Sun Feb 16 13:18:57 2014 +0100 @@ -82,9 +82,13 @@ 'language_name_local', 'bidi', # localization + 'loadl10n', 'localize_on', 'localize_off', 'localize', + 'unlocalize', # timezone - # TODO: check tags against handler + '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)
--- a/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Wed Feb 12 19:54:24 2014 +0100 +++ b/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Sun Feb 16 13:18:57 2014 +0100 @@ -240,7 +240,7 @@ 'Yakutat', 'Yellowknife', ], - 'Antarctica':[ + 'Antarctica': [ 'Casey', 'Davis', 'DumontDUrville', @@ -253,7 +253,7 @@ 'Syowa', 'Vostok', ], - 'Arctic':[ + 'Arctic': [ 'Longyearbyen', ], 'Asia': [ @@ -526,7 +526,7 @@ Private method to update the OK button. """ self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( - bool(self.regionCombo.currentText()) and + bool(self.regionCombo.currentText()) and len(self.cityList.selectedItems()) == 1 ) @@ -535,7 +535,7 @@ """ Private slot handling the selection of a time zone region. - @param region selected region (string) + @param region selected region (string) """ self.cityList.clear() if region in self.Timezones: @@ -556,7 +556,7 @@ @return selected time zone (string) """ - if (self.regionCombo.currentText() and + if (self.regionCombo.currentText() and len(self.cityList.selectedItems()) == 1): return "{0}/{1}".format( self.regionCombo.currentText(),