--- a/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Sat May 29 15:04:13 2021 +0200 +++ b/ProjectDjangoTagsMenu/TimezoneSelectionDialog.py Sun May 30 11:51:44 2021 +0200 @@ -7,8 +7,8 @@ Module implementing a dialog to select a time zone. """ -from PyQt5.QtCore import pyqtSlot -from PyQt5.QtWidgets import QDialog, QDialogButtonBox +from PyQt6.QtCore import pyqtSlot +from PyQt6.QtWidgets import QDialog, QDialogButtonBox from .Ui_TimezoneSelectionDialog import Ui_TimezoneSelectionDialog @@ -18,493 +18,586 @@ Class implementing a dialog to select a time zone. """ Timezones = { - 'Africa': [ - 'Abidjan', - 'Accra', - 'Addis_Ababa', - 'Algiers', - 'Asmara', - 'Asmera', - 'Bamako', - 'Bangui', - 'Banjul', - 'Bissau', - 'Blantyre', - 'Brazzaville', - 'Bujumbura', - 'Cairo', - 'Casablanca', - 'Ceuta', - 'Conakry', - 'Dakar', - 'Dar_es_Salaam', - 'Djibouti', - 'Douala', - 'El_Aaiun', - 'Freetown', - 'Gaborone', - 'Harare', - 'Johannesburg', - 'Juba', - 'Kampala', - 'Khartoum', - 'Kigali', - 'Kinshasa', - 'Lagos', - 'Libreville', - 'Lome', - 'Luanda', - 'Lubumbashi', - 'Lusaka', - 'Malabo', - 'Maputo', - 'Maseru', - 'Mbabane', - 'Mogadishu', - 'Monrovia', - 'Nairobi', - 'Ndjamena', - 'Niamey', - 'Nouakchott', - 'Ouagadougou', - 'Porto-Novo', - 'Sao_Tome', - 'Timbuktu', - 'Tripoli', - 'Tunis', - 'Windhoek', + "Africa": [ + "Abidjan", + "Accra", + "Addis_Ababa", + "Algiers", + "Asmara", + "Asmera", + "Bamako", + "Bangui", + "Banjul", + "Bissau", + "Blantyre", + "Brazzaville", + "Bujumbura", + "Cairo", + "Casablanca", + "Ceuta", + "Conakry", + "Dakar", + "Dar_es_Salaam", + "Djibouti", + "Douala", + "El_Aaiun", + "Freetown", + "Gaborone", + "Harare", + "Johannesburg", + "Juba", + "Kampala", + "Khartoum", + "Kigali", + "Kinshasa", + "Lagos", + "Libreville", + "Lome", + "Luanda", + "Lubumbashi", + "Lusaka", + "Malabo", + "Maputo", + "Maseru", + "Mbabane", + "Mogadishu", + "Monrovia", + "Nairobi", + "Ndjamena", + "Niamey", + "Nouakchott", + "Ouagadougou", + "Porto-Novo", + "Sao_Tome", + "Timbuktu", + "Tripoli", + "Tunis", + "Windhoek", ], - 'America': [ - 'Adak', - 'Anchorage', - 'Anguilla', - 'Antigua', - 'Araguaina', - 'Argentina/Buenos_Aires', - 'Argentina/Catamarca', - 'Argentina/ComodRivadavia', - 'Argentina/Cordoba', - 'Argentina/Jujuy', - 'Argentina/La_Rioja', - 'Argentina/Mendoza', - 'Argentina/Rio_Gallegos', - 'Argentina/Salta', - 'Argentina/San_Juan', - 'Argentina/San_Luis', - 'Argentina/Tucuman', - 'Argentina/Ushuaia', - 'Aruba', - 'Asuncion', - 'Atikokan', - 'Atka', - 'Bahia', - 'Bahia_Banderas', - 'Barbados', - 'Belem', - 'Belize', - 'Blanc-Sablon', - 'Boa_Vista', - 'Bogota', - 'Boise', - 'Buenos_Aires', - 'Cambridge_Bay', - 'Campo_Grande', - 'Cancun', - 'Caracas', - 'Catamarca', - 'Cayenne', - 'Cayman', - 'Chicago', - 'Chihuahua', - 'Coral_Harbour', - 'Cordoba', - 'Costa_Rica', - 'Creston', - 'Cuiaba', - 'Curacao', - 'Danmarkshavn', - 'Dawson', - 'Dawson_Creek', - 'Denver', - 'Detroit', - 'Dominica', - 'Edmonton', - 'Eirunepe', - 'El_Salvador', - 'Ensenada', - 'Fort_Wayne', - 'Fortaleza', - 'Glace_Bay', - 'Godthab', - 'Goose_Bay', - 'Grand_Turk', - 'Grenada', - 'Guadeloupe', - 'Guatemala', - 'Guayaquil', - 'Guyana', - 'Halifax', - 'Havana', - 'Hermosillo', - 'Indiana/Indianapolis', - 'Indiana/Knox', - 'Indiana/Marengo', - 'Indiana/Petersburg', - 'Indiana/Tell_City', - 'Indiana/Vevay', - 'Indiana/Vincennes', - 'Indiana/Winamac', - 'Indianapolis', - 'Inuvik', - 'Iqaluit', - 'Jamaica', - 'Jujuy', - 'Juneau', - 'Kentucky/Louisville', - 'Kentucky/Monticello', - 'Knox_IN', - 'Kralendijk', - 'La_Paz', - 'Lima', - 'Los_Angeles', - 'Louisville', - 'Lower_Princes', - 'Maceio', - 'Managua', - 'Manaus', - 'Marigot', - 'Martinique', - 'Matamoros', - 'Mazatlan', - 'Mendoza', - 'Menominee', - 'Merida', - 'Metlakatla', - 'Mexico_City', - 'Miquelon', - 'Moncton', - 'Monterrey', - 'Montevideo', - 'Montreal', - 'Montserrat', - 'Nassau', - 'New_York', - 'Nipigon', - 'Nome', - 'Noronha', - 'North_Dakota/Beulah', - 'North_Dakota/Center', - 'North_Dakota/New_Salem', - 'Ojinaga', - 'Panama', - 'Pangnirtung', - 'Paramaribo', - 'Phoenix', - 'Port-au-Prince', - 'Port_of_Spain', - 'Porto_Acre', - 'Porto_Velho', - 'Puerto_Rico', - 'Rainy_River', - 'Rankin_Inlet', - 'Recife', - 'Regina', - 'Resolute', - 'Rio_Branco', - 'Rosario', - 'Santa_Isabel', - 'Santarem', - 'Santiago', - 'Santo_Domingo', - 'Sao_Paulo', - 'Scoresbysund', - 'Shiprock', - 'Sitka', - 'St_Barthelemy', - 'St_Johns', - 'St_Kitts', - 'St_Lucia', - 'St_Thomas', - 'St_Vincent', - 'Swift_Current', - 'Tegucigalpa', - 'Thule', - 'Thunder_Bay', - 'Tijuana', - 'Toronto', - 'Tortola', - 'Vancouver', - 'Virgin', - 'Whitehorse', - 'Winnipeg', - 'Yakutat', - 'Yellowknife', + "America": [ + "Adak", + "Anchorage", + "Anguilla", + "Antigua", + "Araguaina", + "Argentina/Buenos_Aires", + "Argentina/Catamarca", + "Argentina/ComodRivadavia", + "Argentina/Cordoba", + "Argentina/Jujuy", + "Argentina/La_Rioja", + "Argentina/Mendoza", + "Argentina/Rio_Gallegos", + "Argentina/Salta", + "Argentina/San_Juan", + "Argentina/San_Luis", + "Argentina/Tucuman", + "Argentina/Ushuaia", + "Aruba", + "Asuncion", + "Atikokan", + "Atka", + "Bahia", + "Bahia_Banderas", + "Barbados", + "Belem", + "Belize", + "Blanc-Sablon", + "Boa_Vista", + "Bogota", + "Boise", + "Buenos_Aires", + "Cambridge_Bay", + "Campo_Grande", + "Cancun", + "Caracas", + "Catamarca", + "Cayenne", + "Cayman", + "Chicago", + "Chihuahua", + "Coral_Harbour", + "Cordoba", + "Costa_Rica", + "Creston", + "Cuiaba", + "Curacao", + "Danmarkshavn", + "Dawson", + "Dawson_Creek", + "Denver", + "Detroit", + "Dominica", + "Edmonton", + "Eirunepe", + "El_Salvador", + "Ensenada", + "Fort_Nelson", + "Fort_Wayne", + "Fortaleza", + "Glace_Bay", + "Godthab", + "Goose_Bay", + "Grand_Turk", + "Grenada", + "Guadeloupe", + "Guatemala", + "Guayaquil", + "Guyana", + "Halifax", + "Havana", + "Hermosillo", + "Indiana/Indianapolis", + "Indiana/Knox", + "Indiana/Marengo", + "Indiana/Petersburg", + "Indiana/Tell_City", + "Indiana/Vevay", + "Indiana/Vincennes", + "Indiana/Winamac", + "Indianapolis", + "Inuvik", + "Iqaluit", + "Jamaica", + "Jujuy", + "Juneau", + "Kentucky/Louisville", + "Kentucky/Monticello", + "Knox_IN", + "Kralendijk", + "La_Paz", + "Lima", + "Los_Angeles", + "Louisville", + "Lower_Princes", + "Maceio", + "Managua", + "Manaus", + "Marigot", + "Martinique", + "Matamoros", + "Mazatlan", + "Mendoza", + "Menominee", + "Merida", + "Metlakatla", + "Mexico_City", + "Miquelon", + "Moncton", + "Monterrey", + "Montevideo", + "Montreal", + "Montserrat", + "Nassau", + "New_York", + "Nipigon", + "Nome", + "Noronha", + "North_Dakota/Beulah", + "North_Dakota/Center", + "North_Dakota/New_Salem", + "Nuuk", + "Ojinaga", + "Panama", + "Pangnirtung", + "Paramaribo", + "Phoenix", + "Port-au-Prince", + "Port_of_Spain", + "Porto_Acre", + "Porto_Velho", + "Puerto_Rico", + "Punta_Arenas", + "Rainy_River", + "Rankin_Inlet", + "Recife", + "Regina", + "Resolute", + "Rio_Branco", + "Rosario", + "Santa_Isabel", + "Santarem", + "Santiago", + "Santo_Domingo", + "Sao_Paulo", + "Scoresbysund", + "Shiprock", + "Sitka", + "St_Barthelemy", + "St_Johns", + "St_Kitts", + "St_Lucia", + "St_Thomas", + "St_Vincent", + "Swift_Current", + "Tegucigalpa", + "Thule", + "Thunder_Bay", + "Tijuana", + "Toronto", + "Tortola", + "Vancouver", + "Virgin", + "Whitehorse", + "Winnipeg", + "Yakutat", + "Yellowknife", ], - 'Antarctica': [ - 'Casey', - 'Davis', - 'DumontDUrville', - 'Macquarie', - 'Mawson', - 'McMurdo', - 'Palmer', - 'Rothera', - 'South_Pole', - 'Syowa', - 'Vostok', + "Antarctica": [ + "Casey", + "Davis", + "DumontDUrville", + "Macquarie", + "Mawson", + "McMurdo", + "Palmer", + "Rothera", + "South_Pole", + "Syowa", + "Troll", + "Vostok", ], - 'Arctic': [ - 'Longyearbyen', + "Arctic": [ + "Longyearbyen", ], - 'Asia': [ - 'Aden', - 'Almaty', - 'Amman', - 'Anadyr', - 'Aqtau', - 'Aqtobe', - 'Ashgabat', - 'Ashkhabad', - 'Baghdad', - 'Bahrain', - 'Baku', - 'Bangkok', - 'Beirut', - 'Bishkek', - 'Brunei', - 'Calcutta', - 'Choibalsan', - 'Chongqing', - 'Chungking', - 'Colombo', - 'Dacca', - 'Damascus', - 'Dhaka', - 'Dili', - 'Dubai', - 'Dushanbe', - 'Gaza', - 'Harbin', - 'Hebron', - 'Ho_Chi_Minh', - 'Hong_Kong', - 'Hovd', - 'Irkutsk', - 'Istanbul', - 'Jakarta', - 'Jayapura', - 'Jerusalem', - 'Kabul', - 'Kamchatka', - 'Karachi', - 'Kashgar', - 'Kathmandu', - 'Katmandu', - 'Khandyga', - 'Kolkata', - 'Krasnoyarsk', - 'Kuala_Lumpur', - 'Kuching', - 'Kuwait', - 'Macao', - 'Macau', - 'Magadan', - 'Makassar', - 'Manila', - 'Muscat', - 'Nicosia', - 'Novokuznetsk', - 'Novosibirsk', - 'Omsk', - 'Oral', - 'Phnom_Penh', - 'Pontianak', - 'Pyongyang', - 'Qatar', - 'Qyzylorda', - 'Rangoon', - 'Riyadh', - 'Saigon', - 'Sakhalin', - 'Samarkand', - 'Seoul', - 'Shanghai', - 'Singapore', - 'Taipei', - 'Tashkent', - 'Tbilisi', - 'Tehran', - 'Tel_Aviv', - 'Thimbu', - 'Thimphu', - 'Tokyo', - 'Ujung_Pandang', - 'Ulaanbaatar', - 'Ulan_Bator', - 'Urumqi', - 'Ust-Nera', - 'Vientiane', - 'Vladivostok', - 'Yakutsk', - 'Yekaterinburg', - 'Yerevan', + "Asia": [ + "Aden", + "Almaty", + "Amman", + "Anadyr", + "Aqtau", + "Aqtobe", + "Ashgabat", + "Ashkhabad", + "Atyrau", + "Baghdad", + "Bahrain", + "Baku", + "Bangkok", + "Barnaul", + "Beirut", + "Bishkek", + "Brunei", + "Calcutta", + "Chita", + "Choibalsan", + "Chongqing", + "Chungking", + "Colombo", + "Dacca", + "Damascus", + "Dhaka", + "Dili", + "Dubai", + "Dushanbe", + "Famagusta", + "Gaza", + "Harbin", + "Hebron", + "Ho_Chi_Minh", + "Hong_Kong", + "Hovd", + "Irkutsk", + "Istanbul", + "Jakarta", + "Jayapura", + "Jerusalem", + "Kabul", + "Kamchatka", + "Karachi", + "Kashgar", + "Kathmandu", + "Katmandu", + "Khandyga", + "Kolkata", + "Krasnoyarsk", + "Kuala_Lumpur", + "Kuching", + "Kuwait", + "Macao", + "Macau", + "Magadan", + "Makassar", + "Manila", + "Muscat", + "Nicosia", + "Novokuznetsk", + "Novosibirsk", + "Omsk", + "Oral", + "Phnom_Penh", + "Pontianak", + "Pyongyang", + "Qatar", + "Qostanay", + "Qyzylorda", + "Rangoon", + "Riyadh", + "Saigon", + "Sakhalin", + "Samarkand", + "Seoul", + "Shanghai", + "Singapore", + "Srednekolymsk", + "Taipei", + "Tashkent", + "Tbilisi", + "Tehran", + "Tel_Aviv", + "Thimbu", + "Thimphu", + "Tokyo", + "Tomsk", + "Ujung_Pandang", + "Ulaanbaatar", + "Ulan_Bator", + "Urumqi", + "Ust-Nera", + "Vientiane", + "Vladivostok", + "Yakutsk", + "Yangon", + "Yekaterinburg", + "Yerevan", ], - 'Atlantic': [ - 'Azores', - 'Bermuda', - 'Canary', - 'Cape_Verde', - 'Faeroe', - 'Faroe', - 'Jan_Mayen', - 'Madeira', - 'Reykjavik', - 'South_Georgia', - 'St_Helena', - 'Stanley', + "Atlantic": [ + "Azores", + "Bermuda", + "Canary", + "Cape_Verde", + "Faeroe", + "Faroe", + "Jan_Mayen", + "Madeira", + "Reykjavik", + "South_Georgia", + "St_Helena", + "Stanley", + ], + "Australia": [ + "ACT", + "Adelaide", + "Brisbane", + "Broken_Hill", + "Canberra", + "Currie", + "Darwin", + "Eucla", + "Hobart", + "LHI", + "Lindeman", + "Lord_Howe", + "Melbourne", + "NSW", + "North", + "Perth", + "Queensland", + "South", + "Sydney", + "Tasmania", + "Victoria", + "West", + "Yancowinna", + ], + "Brazil": [ + "Acre", + "DeNoronha", + "East", + "West", + ], + "Canada": [ + "Atlantic", + "Central", + "Eastern", + "Mountain", + "Newfoundland", + "Pacific", + "Saskatchewan", + "Yukon", + ], + "Chile": [ + "Continental", + "EasterIsland", ], - 'Australia': [ - 'ACT', - 'Adelaide', - 'Brisbane', - 'Broken_Hill', - 'Canberra', - 'Currie', - 'Darwin', - 'Eucla', - 'Hobart', - 'LHI', - 'Lindeman', - 'Lord_Howe', - 'Melbourne', - 'NSW', - 'North', - 'Perth', - 'Queensland', - 'South', - 'Sydney', - 'Tasmania', - 'Victoria', - 'West', - 'Yancowinna', + "Etc": [ + "GMT", + "GMT+0", + "GMT+1", + "GMT+10", + "GMT+11", + "GMT+12", + "GMT+2", + "GMT+3", + "GMT+4", + "GMT+5", + "GMT+6", + "GMT+7", + "GMT+8", + "GMT+9", + "GMT-0", + "GMT-1", + "GMT-10", + "GMT-11", + "GMT-12", + "GMT-13", + "GMT-14", + "GMT-2", + "GMT-3", + "GMT-4", + "GMT-5", + "GMT-6", + "GMT-7", + "GMT-8", + "GMT-9", + "GMT0", + "Greenwich", + "UCT", + "UTC", + "Universal", + "Zulu", ], - 'Europe': [ - 'Amsterdam', - 'Andorra', - 'Athens', - 'Belfast', - 'Belgrade', - 'Berlin', - 'Bratislava', - 'Brussels', - 'Bucharest', - 'Budapest', - 'Busingen', - 'Chisinau', - 'Copenhagen', - 'Dublin', - 'Gibraltar', - 'Guernsey', - 'Helsinki', - 'Isle_of_Man', - 'Istanbul', - 'Jersey', - 'Kaliningrad', - 'Kiev', - 'Lisbon', - 'Ljubljana', - 'London', - 'Luxembourg', - 'Madrid', - 'Malta', - 'Mariehamn', - 'Minsk', - 'Monaco', - 'Moscow', - 'Nicosia', - 'Oslo', - 'Paris', - 'Podgorica', - 'Prague', - 'Riga', - 'Rome', - 'Samara', - 'San_Marino', - 'Sarajevo', - 'Simferopol', - 'Skopje', - 'Sofia', - 'Stockholm', - 'Tallinn', - 'Tirane', - 'Tiraspol', - 'Uzhgorod', - 'Vaduz', - 'Vatican', - 'Vienna', - 'Vilnius', - 'Volgograd', - 'Warsaw', - 'Zagreb', - 'Zaporozhye', - 'Zurich', + "Europe": [ + "Amsterdam", + "Andorra", + "Astrakhan", + "Athens", + "Belfast", + "Belgrade", + "Berlin", + "Bratislava", + "Brussels", + "Bucharest", + "Budapest", + "Busingen", + "Chisinau", + "Copenhagen", + "Dublin", + "Gibraltar", + "Guernsey", + "Helsinki", + "Isle_of_Man", + "Istanbul", + "Jersey", + "Kaliningrad", + "Kiev", + "Kirov", + "Lisbon", + "Ljubljana", + "London", + "Luxembourg", + "Madrid", + "Malta", + "Mariehamn", + "Minsk", + "Monaco", + "Moscow", + "Nicosia", + "Oslo", + "Paris", + "Podgorica", + "Prague", + "Riga", + "Rome", + "Samara", + "San_Marino", + "Sarajevo", + "Saratov", + "Simferopol", + "Skopje", + "Sofia", + "Stockholm", + "Tallinn", + "Tirane", + "Tiraspol", + "Ulyanovsk", + "Uzhgorod", + "Vaduz", + "Vatican", + "Vienna", + "Vilnius", + "Volgograd", + "Warsaw", + "Zagreb", + "Zaporozhye", + "Zurich", ], - 'Indian': [ - 'Antananarivo', - 'Chagos', - 'Christmas', - 'Cocos', - 'Comoro', - 'Kerguelen', - 'Mahe', - 'Maldives', - 'Mauritius', - 'Mayotte', - 'Reunion', + "Indian": [ + "Antananarivo", + "Chagos", + "Christmas", + "Cocos", + "Comoro", + "Kerguelen", + "Mahe", + "Maldives", + "Mauritius", + "Mayotte", + "Reunion", + ], + "Mexico": [ + "BajaNorte", + "BajaSur", + "General", ], - 'Pacific': [ - 'Apia', - 'Auckland', - 'Chatham', - 'Chuuk', - 'Easter', - 'Efate', - 'Enderbury', - 'Fakaofo', - 'Fiji', - 'Funafuti', - 'Galapagos', - 'Gambier', - 'Guadalcanal', - 'Guam', - 'Honolulu', - 'Johnston', - 'Kiritimati', - 'Kosrae', - 'Kwajalein', - 'Majuro', - 'Marquesas', - 'Midway', - 'Nauru', - 'Niue', - 'Norfolk', - 'Noumea', - 'Pago_Pago', - 'Palau', - 'Pitcairn', - 'Pohnpei', - 'Ponape', - 'Port_Moresby', - 'Rarotonga', - 'Saipan', - 'Samoa', - 'Tahiti', - 'Tarawa', - 'Tongatapu', - 'Truk', - 'Wake', - 'Wallis', - 'Yap', + "Pacific": [ + "Apia", + "Auckland", + "Bougainville", + "Chatham", + "Chuuk", + "Easter", + "Efate", + "Enderbury", + "Fakaofo", + "Fiji", + "Funafuti", + "Galapagos", + "Gambier", + "Guadalcanal", + "Guam", + "Honolulu", + "Johnston", + "Kiritimati", + "Kosrae", + "Kwajalein", + "Majuro", + "Marquesas", + "Midway", + "Nauru", + "Niue", + "Norfolk", + "Noumea", + "Pago_Pago", + "Palau", + "Pitcairn", + "Pohnpei", + "Ponape", + "Port_Moresby", + "Rarotonga", + "Saipan", + "Samoa", + "Tahiti", + "Tarawa", + "Tongatapu", + "Truk", + "Wake", + "Wallis", + "Yap", + ], + "US": [ + "Alaska", + "Aleutian", + "Arizona", + "Central", + "East-Indiana", + "Eastern", + "Hawaii", + "Indiana-Starke", + "Michigan", + "Mountain", + "Pacific", + "Samoa", ], } @@ -512,12 +605,14 @@ """ Constructor - @param parent reference to the parent widget (QWidget) + @param parent reference to the parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) + self.buttonBox.button( + QDialogButtonBox.StandardButton.Ok).setEnabled(False) self.regionCombo.addItems([" "] + sorted(self.Timezones.keys())) @@ -525,17 +620,18 @@ """ Private method to update the OK button. """ - self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( bool(self.regionCombo.currentText()) and len(self.cityList.selectedItems()) == 1 ) @pyqtSlot(str) - def on_regionCombo_currentIndexChanged(self, region): + def on_regionCombo_currentTextChanged(self, region): """ Private slot handling the selection of a time zone region. - @param region selected region (string) + @param region selected region + @type str """ self.cityList.clear() if region in self.Timezones: @@ -554,7 +650,8 @@ """ Public method to retrieve the data. - @return selected time zone (string) + @return selected time zone + @rtype str """ if (self.regionCombo.currentText() and len(self.cityList.selectedItems()) == 1): @@ -570,12 +667,14 @@ """ Public static method to select a time zone. - @param parent reference to the parent widget (QWidget) - @return tuple of selected time zone (string) and flag indicating - the acceptance state (boolean) + @param parent reference to the parent widget + @type QWidget + @return tuple of selected time zone and flag indicating the acceptance + state + @rtype tuple of (str, bool) """ dlg = TimezoneSelectionDialog(parent) tz = "" - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: tz = dlg.getData() return tz, bool(tz)