2935 self.__menus["tools"].clear() |
2935 self.__menus["tools"].clear() |
2936 |
2936 |
2937 self.__menus["tools"].addMenu(self.toolGroupsMenu) |
2937 self.__menus["tools"].addMenu(self.toolGroupsMenu) |
2938 act = self.__menus["tools"].addAction(self.trUtf8("Configure Tool Groups ..."), |
2938 act = self.__menus["tools"].addAction(self.trUtf8("Configure Tool Groups ..."), |
2939 self.__toolGroupsConfiguration) |
2939 self.__toolGroupsConfiguration) |
2940 act.setData(QVariant(-1)) |
2940 act.setData(-1) |
2941 act = self.__menus["tools"].addAction(\ |
2941 act = self.__menus["tools"].addAction(\ |
2942 self.trUtf8("Configure current Tool Group ..."), |
2942 self.trUtf8("Configure current Tool Group ..."), |
2943 self.__toolsConfiguration) |
2943 self.__toolsConfiguration) |
2944 act.setData(QVariant(-2)) |
2944 act.setData(-2) |
2945 self.__menus["tools"].addSeparator() |
2945 self.__menus["tools"].addSeparator() |
2946 |
2946 |
2947 if self.currentToolGroup == -1: |
2947 if self.currentToolGroup == -1: |
2948 act.setEnabled(False) |
2948 act.setEnabled(False) |
2949 # add the default entries |
2949 # add the default entries |
2971 if tool['menutext'] == '--': |
2971 if tool['menutext'] == '--': |
2972 self.__menus["tools"].addSeparator() |
2972 self.__menus["tools"].addSeparator() |
2973 else: |
2973 else: |
2974 act = self.__menus["tools"].addAction(\ |
2974 act = self.__menus["tools"].addAction(\ |
2975 UI.PixmapCache.getIcon(tool['icon']), tool['menutext']) |
2975 UI.PixmapCache.getIcon(tool['icon']), tool['menutext']) |
2976 act.setData(QVariant(idx)) |
2976 act.setData(idx) |
2977 idx += 1 |
2977 idx += 1 |
2978 except IndexError: |
2978 except IndexError: |
2979 # the current tool group might have been deleted |
2979 # the current tool group might have been deleted |
2980 pass |
2980 pass |
2981 |
2981 |
2985 """ |
2985 """ |
2986 self.toolGroupsMenu.clear() |
2986 self.toolGroupsMenu.clear() |
2987 |
2987 |
2988 # add the default entry |
2988 # add the default entry |
2989 act = self.toolGroupsMenu.addAction(self.trUtf8("&Builtin Tools")) |
2989 act = self.toolGroupsMenu.addAction(self.trUtf8("&Builtin Tools")) |
2990 act.setData(QVariant(-1)) |
2990 act.setData(-1) |
2991 if self.currentToolGroup == -1: |
2991 if self.currentToolGroup == -1: |
2992 font = act.font() |
2992 font = act.font() |
2993 font.setBold(True) |
2993 font.setBold(True) |
2994 act.setFont(font) |
2994 act.setFont(font) |
2995 |
2995 |
2996 # add the plugins entry |
2996 # add the plugins entry |
2997 act = self.toolGroupsMenu.addAction(self.trUtf8("&Plugin Tools")) |
2997 act = self.toolGroupsMenu.addAction(self.trUtf8("&Plugin Tools")) |
2998 act.setData(QVariant(-2)) |
2998 act.setData(-2) |
2999 if self.currentToolGroup == -2: |
2999 if self.currentToolGroup == -2: |
3000 font = act.font() |
3000 font = act.font() |
3001 font.setBold(True) |
3001 font.setBold(True) |
3002 act.setFont(font) |
3002 act.setFont(font) |
3003 |
3003 |
3004 # add the configurable tool groups |
3004 # add the configurable tool groups |
3005 idx = 0 |
3005 idx = 0 |
3006 for toolGroup in self.toolGroups: |
3006 for toolGroup in self.toolGroups: |
3007 act = self.toolGroupsMenu.addAction(toolGroup[0]) |
3007 act = self.toolGroupsMenu.addAction(toolGroup[0]) |
3008 act.setData(QVariant(idx)) |
3008 act.setData(idx) |
3009 if self.currentToolGroup == idx: |
3009 if self.currentToolGroup == idx: |
3010 font = act.font() |
3010 font = act.font() |
3011 font.setBold(True) |
3011 font.setBold(True) |
3012 act.setFont(font) |
3012 act.setFont(font) |
3013 idx += 1 |
3013 idx += 1 |
3017 Private slot to set the current tool group. |
3017 Private slot to set the current tool group. |
3018 |
3018 |
3019 @param act reference to the action that was triggered (QAction) |
3019 @param act reference to the action that was triggered (QAction) |
3020 """ |
3020 """ |
3021 self.toolGroupsMenuTriggered = True |
3021 self.toolGroupsMenuTriggered = True |
3022 idx, ok = act.data().toInt() |
3022 idx = act.data() |
3023 if ok: |
3023 if idx is not None: |
3024 self.currentToolGroup = idx |
3024 self.currentToolGroup = idx |
3025 |
3025 |
3026 def __showWindowMenu(self): |
3026 def __showWindowMenu(self): |
3027 """ |
3027 """ |
3028 Private slot to display the Window menu. |
3028 Private slot to display the Window menu. |
3125 |
3125 |
3126 tbList.sort() |
3126 tbList.sort() |
3127 for text, tb, name in tbList: |
3127 for text, tb, name in tbList: |
3128 act = self.__menus["toolbars"].addAction(text) |
3128 act = self.__menus["toolbars"].addAction(text) |
3129 act.setCheckable(True) |
3129 act.setCheckable(True) |
3130 act.setData(QVariant(name)) |
3130 act.setData(name) |
3131 act.setChecked(not tb.isHidden()) |
3131 act.setChecked(not tb.isHidden()) |
3132 self.__menus["toolbars"].addSeparator() |
3132 self.__menus["toolbars"].addSeparator() |
3133 self.__toolbarsShowAllAct = \ |
3133 self.__toolbarsShowAllAct = \ |
3134 self.__menus["toolbars"].addAction(self.trUtf8("&Show all")) |
3134 self.__menus["toolbars"].addAction(self.trUtf8("&Show all")) |
3135 self.__toolbarsHideAllAct = \ |
3135 self.__toolbarsHideAllAct = \ |
3150 for text, tb in self.__toolbars.values(): |
3150 for text, tb in self.__toolbars.values(): |
3151 tb.hide() |
3151 tb.hide() |
3152 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3152 if self.__menus["toolbars"].isTearOffMenuVisible(): |
3153 self.__showToolbarsMenu() |
3153 self.__showToolbarsMenu() |
3154 else: |
3154 else: |
3155 name = act.data().toString() |
3155 name = act.data() |
3156 if name: |
3156 if name: |
3157 tb = self.__toolbars[name][1] |
3157 tb = self.__toolbars[name][1] |
3158 if act.isChecked(): |
3158 if act.isChecked(): |
3159 tb.show() |
3159 tb.show() |
3160 else: |
3160 else: |
4168 |
4168 |
4169 if self.currentToolGroup < 0: |
4169 if self.currentToolGroup < 0: |
4170 # it was a built in or plugin tool, don't handle it here |
4170 # it was a built in or plugin tool, don't handle it here |
4171 return |
4171 return |
4172 |
4172 |
4173 idx, ok = act.data().toInt() |
4173 idx = act.data() |
4174 if ok and idx >= 0: |
4174 if idx is not None and idx >= 0: |
4175 tool = self.toolGroups[self.currentToolGroup][1][idx] |
4175 tool = self.toolGroups[self.currentToolGroup][1][idx] |
4176 self.__startToolProcess(tool) |
4176 self.__startToolProcess(tool) |
4177 |
4177 |
4178 def __startToolProcess(self, tool): |
4178 def __startToolProcess(self, tool): |
4179 """ |
4179 """ |
5193 period = Preferences.getUI("PerformVersionCheck") |
5193 period = Preferences.getUI("PerformVersionCheck") |
5194 if period == 0: |
5194 if period == 0: |
5195 return |
5195 return |
5196 elif period in [2, 3, 4]: |
5196 elif period in [2, 3, 4]: |
5197 lastCheck = Preferences.Prefs.settings.value(\ |
5197 lastCheck = Preferences.Prefs.settings.value(\ |
5198 "Updates/LastCheckDate", QVariant(QDate(1970, 1, 1))).toDate() |
5198 "Updates/LastCheckDate", QDate(1970, 1, 1)) |
5199 if lastCheck.isValid(): |
5199 if lastCheck.isValid(): |
5200 now = QDate.currentDate() |
5200 now = QDate.currentDate() |
5201 if period == 2 and lastCheck.day() == now.day(): |
5201 if period == 2 and lastCheck.day() == now.day(): |
5202 # daily |
5202 # daily |
5203 return |
5203 return |
5299 self.__updateVersionsUrls(versions) |
5299 self.__updateVersionsUrls(versions) |
5300 if self.showAvailableVersions: |
5300 if self.showAvailableVersions: |
5301 self.__showAvailableVersionInfos(versions) |
5301 self.__showAvailableVersionInfos(versions) |
5302 else: |
5302 else: |
5303 Preferences.Prefs.settings.setValue(\ |
5303 Preferences.Prefs.settings.setValue(\ |
5304 "Updates/LastCheckDate", QVariant(QDate.currentDate())) |
5304 "Updates/LastCheckDate", QDate.currentDate()) |
5305 self.__versionCheckResult(versions) |
5305 self.__versionCheckResult(versions) |
5306 |
5306 |
5307 def __updateVersionsUrls(self, versions): |
5307 def __updateVersionsUrls(self, versions): |
5308 """ |
5308 """ |
5309 Private method to update the URLs from which to retrieve the versions file. |
5309 Private method to update the URLs from which to retrieve the versions file. |