23 |
23 |
24 class DotDesktopWizardDialog(QDialog, Ui_DotDesktopWizardDialog): |
24 class DotDesktopWizardDialog(QDialog, Ui_DotDesktopWizardDialog): |
25 """ |
25 """ |
26 Class implementing the .desktop wizard dialog. |
26 Class implementing the .desktop wizard dialog. |
27 """ |
27 """ |
|
28 |
28 def __init__(self, parent=None): |
29 def __init__(self, parent=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 |
32 |
32 @param parent reference to the parent widget (QWidget) |
33 @param parent reference to the parent widget (QWidget) |
33 """ |
34 """ |
34 super().__init__(parent) |
35 super().__init__(parent) |
35 self.setupUi(self) |
36 self.setupUi(self) |
36 |
37 |
37 self.buttonBox.button( |
38 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
38 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
39 |
39 |
|
40 self.__mainCategories = [ |
40 self.__mainCategories = [ |
41 'AudioVideo', 'Audio', 'Video', 'Development', 'Education', |
41 "AudioVideo", |
42 'Game', 'Graphics', 'Network', 'Office', 'Science', 'Settings', |
42 "Audio", |
43 'System', 'Utility', |
43 "Video", |
|
44 "Development", |
|
45 "Education", |
|
46 "Game", |
|
47 "Graphics", |
|
48 "Network", |
|
49 "Office", |
|
50 "Science", |
|
51 "Settings", |
|
52 "System", |
|
53 "Utility", |
44 ] |
54 ] |
45 |
55 |
46 self.__subCategories = [ |
56 self.__subCategories = [ |
47 'Building', 'Debugger', 'IDE', 'GUIDesigner', 'Profiling', |
57 "Building", |
48 'RevisionControl', 'Translation', 'Calendar', 'ContactManagement', |
58 "Debugger", |
49 'Database', 'Dictionary', 'Chart', 'Email', 'Finance', 'FlowChart', |
59 "IDE", |
50 'PDA', 'ProjectManagement', 'Presentation', 'Spreadsheet', |
60 "GUIDesigner", |
51 'WordProcessor', '2DGraphics', 'VectorGraphics', 'RasterGraphics', |
61 "Profiling", |
52 '3DGraphics', 'Scanning', 'OCR', 'Photography', 'Publishing', |
62 "RevisionControl", |
53 'Viewer', 'TextTools', 'DesktopSettings', 'HardwareSettings', |
63 "Translation", |
54 'Printing', 'PackageManager', 'Dialup', 'InstantMessaging', 'Chat', |
64 "Calendar", |
55 'IRCClient', 'Feed', 'FileTransfer', 'HamRadio', 'News', 'P2P', |
65 "ContactManagement", |
56 'RemoteAccess', 'Telephony', 'TelephonyTools', 'VideoConference', |
66 "Database", |
57 'WebBrowser', 'WebDevelopment', 'Midi', 'Mixer', 'Sequencer', |
67 "Dictionary", |
58 'Tuner', 'TV', 'AudioVideoEditing', 'Player', 'Recorder', |
68 "Chart", |
59 'DiscBurning', 'ActionGame', 'AdventureGame', 'ArcadeGame', |
69 "Email", |
60 'BoardGame', 'BlocksGame', 'CardGame', 'KidsGame', 'LogicGame', |
70 "Finance", |
61 'RolePlaying', 'Shooter', 'Simulation', 'SportsGame', |
71 "FlowChart", |
62 'StrategyGame', 'Art', 'Construction', 'Music', 'Languages', |
72 "PDA", |
63 'ArtificialIntelligence', 'Astronomy', 'Biology', 'Chemistry', |
73 "ProjectManagement", |
64 'ComputerScience', 'DataVisualization', 'Economy', 'Electricity', |
74 "Presentation", |
65 'Geography', 'Geology', 'Geoscience', 'History', 'Humanities', |
75 "Spreadsheet", |
66 'ImageProcessing', 'Literature', 'Maps', 'Math', |
76 "WordProcessor", |
67 'NumericalAnalysis', 'MedicalSoftware', 'Physics', 'Robotics', |
77 "2DGraphics", |
68 'Spirituality', 'Sports', 'ParallelComputing', 'Amusement', |
78 "VectorGraphics", |
69 'Archiving', 'Compression', 'Electronics', 'Emulator', |
79 "RasterGraphics", |
70 'Engineering', 'FileTools', 'FileManager', 'TerminalEmulator', |
80 "3DGraphics", |
71 'Filesystem', 'Monitor', 'Security', 'Accessibility', 'Calculator', |
81 "Scanning", |
72 'Clock', 'TextEditor', 'Documentation', 'Adult', 'Core', 'KDE', |
82 "OCR", |
73 'GNOME', 'XFCE', 'GTK', 'Qt', 'Motif', 'Java', 'ConsoleOnly', |
83 "Photography", |
|
84 "Publishing", |
|
85 "Viewer", |
|
86 "TextTools", |
|
87 "DesktopSettings", |
|
88 "HardwareSettings", |
|
89 "Printing", |
|
90 "PackageManager", |
|
91 "Dialup", |
|
92 "InstantMessaging", |
|
93 "Chat", |
|
94 "IRCClient", |
|
95 "Feed", |
|
96 "FileTransfer", |
|
97 "HamRadio", |
|
98 "News", |
|
99 "P2P", |
|
100 "RemoteAccess", |
|
101 "Telephony", |
|
102 "TelephonyTools", |
|
103 "VideoConference", |
|
104 "WebBrowser", |
|
105 "WebDevelopment", |
|
106 "Midi", |
|
107 "Mixer", |
|
108 "Sequencer", |
|
109 "Tuner", |
|
110 "TV", |
|
111 "AudioVideoEditing", |
|
112 "Player", |
|
113 "Recorder", |
|
114 "DiscBurning", |
|
115 "ActionGame", |
|
116 "AdventureGame", |
|
117 "ArcadeGame", |
|
118 "BoardGame", |
|
119 "BlocksGame", |
|
120 "CardGame", |
|
121 "KidsGame", |
|
122 "LogicGame", |
|
123 "RolePlaying", |
|
124 "Shooter", |
|
125 "Simulation", |
|
126 "SportsGame", |
|
127 "StrategyGame", |
|
128 "Art", |
|
129 "Construction", |
|
130 "Music", |
|
131 "Languages", |
|
132 "ArtificialIntelligence", |
|
133 "Astronomy", |
|
134 "Biology", |
|
135 "Chemistry", |
|
136 "ComputerScience", |
|
137 "DataVisualization", |
|
138 "Economy", |
|
139 "Electricity", |
|
140 "Geography", |
|
141 "Geology", |
|
142 "Geoscience", |
|
143 "History", |
|
144 "Humanities", |
|
145 "ImageProcessing", |
|
146 "Literature", |
|
147 "Maps", |
|
148 "Math", |
|
149 "NumericalAnalysis", |
|
150 "MedicalSoftware", |
|
151 "Physics", |
|
152 "Robotics", |
|
153 "Spirituality", |
|
154 "Sports", |
|
155 "ParallelComputing", |
|
156 "Amusement", |
|
157 "Archiving", |
|
158 "Compression", |
|
159 "Electronics", |
|
160 "Emulator", |
|
161 "Engineering", |
|
162 "FileTools", |
|
163 "FileManager", |
|
164 "TerminalEmulator", |
|
165 "Filesystem", |
|
166 "Monitor", |
|
167 "Security", |
|
168 "Accessibility", |
|
169 "Calculator", |
|
170 "Clock", |
|
171 "TextEditor", |
|
172 "Documentation", |
|
173 "Adult", |
|
174 "Core", |
|
175 "KDE", |
|
176 "GNOME", |
|
177 "XFCE", |
|
178 "GTK", |
|
179 "Qt", |
|
180 "Motif", |
|
181 "Java", |
|
182 "ConsoleOnly", |
74 ] |
183 ] |
75 |
184 |
76 self.__showinEnvironments = [ |
185 self.__showinEnvironments = [ |
77 'GNOME', 'KDE', 'LXDE', 'LXQt', 'MATE', 'Razor', 'ROX', 'TDE', |
186 "GNOME", |
78 'Unity', 'XFCE', 'EDE', 'Cinnamon', 'Pantheon', 'Old', |
187 "KDE", |
|
188 "LXDE", |
|
189 "LXQt", |
|
190 "MATE", |
|
191 "Razor", |
|
192 "ROX", |
|
193 "TDE", |
|
194 "Unity", |
|
195 "XFCE", |
|
196 "EDE", |
|
197 "Cinnamon", |
|
198 "Pantheon", |
|
199 "Old", |
79 ] |
200 ] |
80 |
201 |
81 self.typeComboBox.addItems([ |
202 self.typeComboBox.addItems( |
82 self.tr("FreeDesktop Standard .desktop"), |
203 [ |
83 self.tr("KDE Plasma MetaData .desktop"), |
204 self.tr("FreeDesktop Standard .desktop"), |
84 self.tr("Ubuntu Unity QuickList .desktop"), |
205 self.tr("KDE Plasma MetaData .desktop"), |
85 ]) |
206 self.tr("Ubuntu Unity QuickList .desktop"), |
86 |
207 ] |
87 self.kdeCategoryComboBox.addItems([ |
208 ) |
88 '', 'Application Launchers', 'Accessibility', 'Astronomy', |
209 |
89 'Date and Time', 'Development Tools', 'Education', 'Environment', |
210 self.kdeCategoryComboBox.addItems( |
90 'Examples', 'File System', 'Fun and Games', 'Graphics', |
211 [ |
91 'Language', 'Mapping', 'Multimedia', 'Online Services', |
212 "", |
92 'System Information', 'Utilities', 'Windows and Tasks', |
213 "Application Launchers", |
93 'Miscelaneous', |
214 "Accessibility", |
94 ]) |
215 "Astronomy", |
95 |
216 "Date and Time", |
96 self.kdeApiComboBox.addItems([ |
217 "Development Tools", |
97 'Python', 'Javascript', 'Ruby', 'C++', 'HTML5', 'QML' |
218 "Education", |
98 ]) |
219 "Environment", |
99 |
220 "Examples", |
|
221 "File System", |
|
222 "Fun and Games", |
|
223 "Graphics", |
|
224 "Language", |
|
225 "Mapping", |
|
226 "Multimedia", |
|
227 "Online Services", |
|
228 "System Information", |
|
229 "Utilities", |
|
230 "Windows and Tasks", |
|
231 "Miscelaneous", |
|
232 ] |
|
233 ) |
|
234 |
|
235 self.kdeApiComboBox.addItems( |
|
236 ["Python", "Javascript", "Ruby", "C++", "HTML5", "QML"] |
|
237 ) |
|
238 |
100 self.kdeEncodingComboBox.addItems(sorted(Utilities.supportedCodecs)) |
239 self.kdeEncodingComboBox.addItems(sorted(Utilities.supportedCodecs)) |
101 self.kdeEncodingComboBox.setCurrentIndex( |
240 self.kdeEncodingComboBox.setCurrentIndex( |
102 self.kdeEncodingComboBox.findText("utf-8")) |
241 self.kdeEncodingComboBox.findText("utf-8") |
103 |
242 ) |
|
243 |
104 projectOpen = ericApp().getObject("Project").isOpen() |
244 projectOpen = ericApp().getObject("Project").isOpen() |
105 self.projectButton.setEnabled(projectOpen) |
245 self.projectButton.setEnabled(projectOpen) |
106 |
246 |
107 icon = UI.PixmapCache.getIcon("listSelection") |
247 icon = UI.PixmapCache.getIcon("listSelection") |
108 self.categoriesButton.setIcon(icon) |
248 self.categoriesButton.setIcon(icon) |
109 self.onlyShowButton.setIcon(icon) |
249 self.onlyShowButton.setIcon(icon) |
110 self.notShowButton.setIcon(icon) |
250 self.notShowButton.setIcon(icon) |
111 |
251 |
112 def getCode(self): |
252 def getCode(self): |
113 """ |
253 """ |
114 Public method to get the source code. |
254 Public method to get the source code. |
115 |
255 |
116 @return generated code (string) |
256 @return generated code (string) |
117 """ |
257 """ |
118 # step 1: standard desktop entries |
258 # step 1: standard desktop entries |
119 code = [ |
259 code = [ |
120 '[Desktop Entry]', |
260 "[Desktop Entry]", |
121 'Type=' + self.typeEdit.text(), |
261 "Type=" + self.typeEdit.text(), |
122 ] |
262 ] |
123 if self.versionEdit.text(): |
263 if self.versionEdit.text(): |
124 code.append('Version=' + self.versionEdit.text()) |
264 code.append("Version=" + self.versionEdit.text()) |
125 code.append('Name=' + self.nameEdit.text()) |
265 code.append("Name=" + self.nameEdit.text()) |
126 if self.genericNameEdit.text(): |
266 if self.genericNameEdit.text(): |
127 code.append('GenericName=' + self.genericNameEdit.text()) |
267 code.append("GenericName=" + self.genericNameEdit.text()) |
128 if self.commentEdit.text(): |
268 if self.commentEdit.text(): |
129 code.append('Comment=' + self.commentEdit.text()) |
269 code.append("Comment=" + self.commentEdit.text()) |
130 if self.iconFileEdit.text(): |
270 if self.iconFileEdit.text(): |
131 code.append('Icon=' + self.iconFileEdit.text()) |
271 code.append("Icon=" + self.iconFileEdit.text()) |
132 if self.onlyShowEdit.text(): |
272 if self.onlyShowEdit.text(): |
133 code.append('OnlyShowIn=' + self.onlyShowEdit.text()) |
273 code.append("OnlyShowIn=" + self.onlyShowEdit.text()) |
134 if self.notShowEdit.text(): |
274 if self.notShowEdit.text(): |
135 code.append('NotShowIn=' + self.notShowEdit.text()) |
275 code.append("NotShowIn=" + self.notShowEdit.text()) |
136 if self.tryExecEdit.text(): |
276 if self.tryExecEdit.text(): |
137 code.append('TryExec=' + self.tryExecEdit.text()) |
277 code.append("TryExec=" + self.tryExecEdit.text()) |
138 if self.execEdit.text(): |
278 if self.execEdit.text(): |
139 code.append('Exec=' + self.execEdit.text()) |
279 code.append("Exec=" + self.execEdit.text()) |
140 if self.pathEdit.text(): |
280 if self.pathEdit.text(): |
141 code.append('Path=' + self.pathEdit.text()) |
281 code.append("Path=" + self.pathEdit.text()) |
142 if self.terminalCheckBox.isChecked(): |
282 if self.terminalCheckBox.isChecked(): |
143 code.append('Terminal=true') |
283 code.append("Terminal=true") |
144 if self.actionsEdit.text(): |
284 if self.actionsEdit.text(): |
145 code.append('Actions=' + self.actionsEdit.text()) |
285 code.append("Actions=" + self.actionsEdit.text()) |
146 if self.mimetypeEdit.text(): |
286 if self.mimetypeEdit.text(): |
147 code.append('MimeType=' + self.mimetypeEdit.text()) |
287 code.append("MimeType=" + self.mimetypeEdit.text()) |
148 if self.categoriesEdit.text(): |
288 if self.categoriesEdit.text(): |
149 code.append('Categories=' + self.categoriesEdit.text()) |
289 code.append("Categories=" + self.categoriesEdit.text()) |
150 |
290 |
151 # step 2a: KDE Plasma entries |
291 # step 2a: KDE Plasma entries |
152 if self.typeComboBox.currentIndex() == 1: |
292 if self.typeComboBox.currentIndex() == 1: |
153 if self.kdeEncodingComboBox.currentText(): |
293 if self.kdeEncodingComboBox.currentText(): |
154 code.append('Encoding=' + |
294 code.append("Encoding=" + self.kdeEncodingComboBox.currentText()) |
155 self.kdeEncodingComboBox.currentText()) |
|
156 if self.kdeServiceTypeEdit.text(): |
295 if self.kdeServiceTypeEdit.text(): |
157 code.append('ServiceTypes=' + |
296 code.append("ServiceTypes=" + self.kdeServiceTypeEdit.text()) |
158 self.kdeServiceTypeEdit.text()) |
|
159 if self.kdeApiComboBox.currentText(): |
297 if self.kdeApiComboBox.currentText(): |
160 code.append('X-Plasma-API=' + |
298 code.append("X-Plasma-API=" + self.kdeApiComboBox.currentText()) |
161 self.kdeApiComboBox.currentText()) |
|
162 if self.kdeMainScriptEdit.text(): |
299 if self.kdeMainScriptEdit.text(): |
163 code.append('X-Plasma-MainScript=' + |
300 code.append("X-Plasma-MainScript=" + self.kdeMainScriptEdit.text()) |
164 self.kdeMainScriptEdit.text()) |
|
165 if self.kdeAuthorEdit.text(): |
301 if self.kdeAuthorEdit.text(): |
166 code.append('X-KDE-PluginInfo-Author=' + |
302 code.append("X-KDE-PluginInfo-Author=" + self.kdeAuthorEdit.text()) |
167 self.kdeAuthorEdit.text()) |
|
168 if self.kdeEmailEdit.text(): |
303 if self.kdeEmailEdit.text(): |
169 code.append('X-KDE-PluginInfo-Email=' + |
304 code.append("X-KDE-PluginInfo-Email=" + self.kdeEmailEdit.text()) |
170 self.kdeEmailEdit.text()) |
|
171 if self.kdeNameEdit.text(): |
305 if self.kdeNameEdit.text(): |
172 code.append('X-KDE-PluginInfo-Name=' + |
306 code.append("X-KDE-PluginInfo-Name=" + self.kdeNameEdit.text()) |
173 self.kdeNameEdit.text()) |
|
174 if self.kdeVersionEdit.text(): |
307 if self.kdeVersionEdit.text(): |
175 code.append('X-KDE-PluginInfo-Version=' + |
308 code.append("X-KDE-PluginInfo-Version=" + self.kdeVersionEdit.text()) |
176 self.kdeVersionEdit.text()) |
|
177 if self.kdeWebsiteEdit.text(): |
309 if self.kdeWebsiteEdit.text(): |
178 code.append('X-KDE-PluginInfo-Website=' + |
310 code.append("X-KDE-PluginInfo-Website=" + self.kdeWebsiteEdit.text()) |
179 self.kdeWebsiteEdit.text()) |
|
180 if self.kdeCategoryComboBox.currentText(): |
311 if self.kdeCategoryComboBox.currentText(): |
181 code.append('X-KDE-PluginInfo-Category=' + |
312 code.append( |
182 self.kdeCategoryComboBox.currentText()) |
313 "X-KDE-PluginInfo-Category=" |
|
314 + self.kdeCategoryComboBox.currentText() |
|
315 ) |
183 if self.kdeDependsEdit.text(): |
316 if self.kdeDependsEdit.text(): |
184 code.append('X-KDE-PluginInfo-Depends=' + |
317 code.append("X-KDE-PluginInfo-Depends=" + self.kdeDependsEdit.text()) |
185 self.kdeDependsEdit.text()) |
|
186 if self.kdeLicensEdit.text(): |
318 if self.kdeLicensEdit.text(): |
187 code.append('X-KDE-PluginInfo-License=' + |
319 code.append("X-KDE-PluginInfo-License=" + self.kdeLicensEdit.text()) |
188 self.kdeLicensEdit.text()) |
|
189 if self.kdeEnabledDefaultCheckBox.isChecked(): |
320 if self.kdeEnabledDefaultCheckBox.isChecked(): |
190 code.append('X-KDE-PluginInfo-EnabledByDefault=true') |
321 code.append("X-KDE-PluginInfo-EnabledByDefault=true") |
191 |
322 |
192 # step 2b: Unity entries |
323 # step 2b: Unity entries |
193 if ( |
324 if self.typeComboBox.currentIndex() == 2 and self.unityShortcutsEdit.text(): |
194 self.typeComboBox.currentIndex() == 2 and |
325 code.append("X-Ayatana-Desktop-Shortcuts=" + self.unityShortcutsEdit.text()) |
195 self.unityShortcutsEdit.text() |
326 |
196 ): |
|
197 code.append('X-Ayatana-Desktop-Shortcuts=' + |
|
198 self.unityShortcutsEdit.text()) |
|
199 |
|
200 # step 3: action entries |
327 # step 3: action entries |
201 actions = [act for act in self.actionsEdit.text().split(";") if act] |
328 actions = [act for act in self.actionsEdit.text().split(";") if act] |
202 for act in actions: |
329 for act in actions: |
203 code.append('') |
330 code.append("") |
204 code.append('[Desktop Action {0}]'.format(act)) |
331 code.append("[Desktop Action {0}]".format(act)) |
205 code.append('Name={0}'.format(act)) |
332 code.append("Name={0}".format(act)) |
206 code.append('Icon=<Icon Path>') |
333 code.append("Icon=<Icon Path>") |
207 code.append('Exec=<Executable command>') |
334 code.append("Exec=<Executable command>") |
208 |
335 |
209 # step 4: add empty last line |
336 # step 4: add empty last line |
210 code.append('') |
337 code.append("") |
211 |
338 |
212 return os.linesep.join(code) |
339 return os.linesep.join(code) |
213 |
340 |
214 def __checkOK(self): |
341 def __checkOK(self): |
215 """ |
342 """ |
216 Private slot to check, if the OK button should be enabled. |
343 Private slot to check, if the OK button should be enabled. |
217 """ |
344 """ |
218 enable = bool(self.nameEdit.text()) and bool(self.typeEdit.text()) |
345 enable = bool(self.nameEdit.text()) and bool(self.typeEdit.text()) |
219 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
346 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
220 enable = False |
347 enable = False |
221 self.buttonBox.button( |
348 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
222 QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
349 |
223 |
|
224 @pyqtSlot(int) |
350 @pyqtSlot(int) |
225 def on_typeComboBox_currentIndexChanged(self, index): |
351 def on_typeComboBox_currentIndexChanged(self, index): |
226 """ |
352 """ |
227 Private slot to handle a change of the .desktop type. |
353 Private slot to handle a change of the .desktop type. |
228 |
354 |
229 @param index index of the selected entry (integer) |
355 @param index index of the selected entry (integer) |
230 """ |
356 """ |
231 self.dataTabWidget.setTabEnabled(1, index == 1) |
357 self.dataTabWidget.setTabEnabled(1, index == 1) |
232 self.dataTabWidget.setTabEnabled(2, index == 2) |
358 self.dataTabWidget.setTabEnabled(2, index == 2) |
233 |
359 |
234 @pyqtSlot() |
360 @pyqtSlot() |
235 def on_projectButton_clicked(self): |
361 def on_projectButton_clicked(self): |
236 """ |
362 """ |
237 Private slot to populate some fields with data retrieved from the |
363 Private slot to populate some fields with data retrieved from the |
238 current project. |
364 current project. |
239 """ |
365 """ |
240 project = ericApp().getObject("Project") |
366 project = ericApp().getObject("Project") |
241 |
367 |
242 self.nameEdit.setText(project.getProjectName()) |
368 self.nameEdit.setText(project.getProjectName()) |
243 self.genericNameEdit.setText(project.getProjectName()) |
369 self.genericNameEdit.setText(project.getProjectName()) |
244 self.kdeNameEdit.setText(project.getProjectName()) |
370 self.kdeNameEdit.setText(project.getProjectName()) |
245 try: |
371 try: |
246 self.kdeVersionEdit.setText(project.getProjectVersion()) |
372 self.kdeVersionEdit.setText(project.getProjectVersion()) |
253 mainscript = project.getMainScript(True) |
379 mainscript = project.getMainScript(True) |
254 if mainscript: |
380 if mainscript: |
255 self.kdeMainScriptEdit.setText(mainscript) |
381 self.kdeMainScriptEdit.setText(mainscript) |
256 self.execEdit.setText(mainscript) |
382 self.execEdit.setText(mainscript) |
257 self.tryExecEdit.setText(mainscript) |
383 self.tryExecEdit.setText(mainscript) |
258 |
384 |
259 # prevent overwriting of entries by disabling the button |
385 # prevent overwriting of entries by disabling the button |
260 self.projectButton.setEnabled(False) |
386 self.projectButton.setEnabled(False) |
261 |
387 |
262 @pyqtSlot() |
388 @pyqtSlot() |
263 def on_categoriesButton_clicked(self): |
389 def on_categoriesButton_clicked(self): |
264 """ |
390 """ |
265 Private slot to select the categories. |
391 Private slot to select the categories. |
266 """ |
392 """ |
267 from .DotDesktopListSelectionDialog import ( |
393 from .DotDesktopListSelectionDialog import DotDesktopListSelectionDialog |
268 DotDesktopListSelectionDialog |
394 |
269 ) |
|
270 dlg = DotDesktopListSelectionDialog( |
395 dlg = DotDesktopListSelectionDialog( |
271 self.__mainCategories, |
396 self.__mainCategories, |
272 self.categoriesEdit.text(), ";", |
397 self.categoriesEdit.text(), |
|
398 ";", |
273 subEntries=self.__subCategories, |
399 subEntries=self.__subCategories, |
274 allowMultiMain=False) |
400 allowMultiMain=False, |
|
401 ) |
275 if dlg.exec() == QDialog.DialogCode.Accepted: |
402 if dlg.exec() == QDialog.DialogCode.Accepted: |
276 categories = dlg.getData(";", True) |
403 categories = dlg.getData(";", True) |
277 self.categoriesEdit.setText(categories) |
404 self.categoriesEdit.setText(categories) |
278 |
405 |
279 @pyqtSlot(str) |
406 @pyqtSlot(str) |
280 def on_onlyShowEdit_textChanged(self, txt): |
407 def on_onlyShowEdit_textChanged(self, txt): |
281 """ |
408 """ |
282 Private slot to check the contents of the onlyShowEdit field. |
409 Private slot to check the contents of the onlyShowEdit field. |
283 |
410 |
284 @param txt text of the entry field (string) |
411 @param txt text of the entry field (string) |
285 """ |
412 """ |
286 self.__checkOK() |
413 self.__checkOK() |
287 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
414 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
288 EricMessageBox.critical( |
415 EricMessageBox.critical( |
289 self, |
416 self, |
290 self.tr(".desktop Wizard"), |
417 self.tr(".desktop Wizard"), |
291 self.tr("""Only one of 'Only Show In' or """ |
418 self.tr( |
292 """ 'Not Show In' allowed.""")) |
419 """Only one of 'Only Show In' or """ """ 'Not Show In' allowed.""" |
293 |
420 ), |
|
421 ) |
|
422 |
294 @pyqtSlot() |
423 @pyqtSlot() |
295 def on_onlyShowButton_clicked(self): |
424 def on_onlyShowButton_clicked(self): |
296 """ |
425 """ |
297 Private slot to select the OnlyShowIn environments. |
426 Private slot to select the OnlyShowIn environments. |
298 """ |
427 """ |
299 from .DotDesktopListSelectionDialog import ( |
428 from .DotDesktopListSelectionDialog import DotDesktopListSelectionDialog |
300 DotDesktopListSelectionDialog |
429 |
301 ) |
|
302 dlg = DotDesktopListSelectionDialog( |
430 dlg = DotDesktopListSelectionDialog( |
303 self.__showinEnvironments, |
431 self.__showinEnvironments, self.onlyShowEdit.text(), ";" |
304 self.onlyShowEdit.text(), ";") |
432 ) |
305 if dlg.exec() == QDialog.DialogCode.Accepted: |
433 if dlg.exec() == QDialog.DialogCode.Accepted: |
306 environments = dlg.getData(";", True) |
434 environments = dlg.getData(";", True) |
307 self.onlyShowEdit.setText(environments) |
435 self.onlyShowEdit.setText(environments) |
308 |
436 |
309 @pyqtSlot(str) |
437 @pyqtSlot(str) |
310 def on_notShowEdit_textChanged(self, txt): |
438 def on_notShowEdit_textChanged(self, txt): |
311 """ |
439 """ |
312 Private slot to check the contents of the notShowEdit field. |
440 Private slot to check the contents of the notShowEdit field. |
313 |
441 |
314 @param txt text of the entry field (string) |
442 @param txt text of the entry field (string) |
315 """ |
443 """ |
316 self.__checkOK() |
444 self.__checkOK() |
317 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
445 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()): |
318 EricMessageBox.critical( |
446 EricMessageBox.critical( |
319 self, |
447 self, |
320 self.tr(".desktop Wizard"), |
448 self.tr(".desktop Wizard"), |
321 self.tr("""Only one of 'Only Show In' or """ |
449 self.tr( |
322 """ 'Not Show In' allowed.""")) |
450 """Only one of 'Only Show In' or """ """ 'Not Show In' allowed.""" |
323 |
451 ), |
|
452 ) |
|
453 |
324 @pyqtSlot() |
454 @pyqtSlot() |
325 def on_notShowButton_clicked(self): |
455 def on_notShowButton_clicked(self): |
326 """ |
456 """ |
327 Private slot to select the NotShowIn environments. |
457 Private slot to select the NotShowIn environments. |
328 """ |
458 """ |
329 from .DotDesktopListSelectionDialog import ( |
459 from .DotDesktopListSelectionDialog import DotDesktopListSelectionDialog |
330 DotDesktopListSelectionDialog |
460 |
331 ) |
|
332 dlg = DotDesktopListSelectionDialog( |
461 dlg = DotDesktopListSelectionDialog( |
333 self.__showinEnvironments, |
462 self.__showinEnvironments, self.notShowEdit.text(), ";" |
334 self.notShowEdit.text(), ";") |
463 ) |
335 if dlg.exec() == QDialog.DialogCode.Accepted: |
464 if dlg.exec() == QDialog.DialogCode.Accepted: |
336 environments = dlg.getData(";", True) |
465 environments = dlg.getData(";", True) |
337 self.notShowEdit.setText(environments) |
466 self.notShowEdit.setText(environments) |
338 |
467 |
339 @pyqtSlot(str) |
468 @pyqtSlot(str) |
340 def on_typeEdit_textChanged(self, txt): |
469 def on_typeEdit_textChanged(self, txt): |
341 """ |
470 """ |
342 Private slot to check, if the typeEdit field is empty. |
471 Private slot to check, if the typeEdit field is empty. |
343 |
472 |
344 @param txt text of the entry field (string) |
473 @param txt text of the entry field (string) |
345 """ |
474 """ |
346 self.__checkOK() |
475 self.__checkOK() |
347 |
476 |
348 @pyqtSlot(str) |
477 @pyqtSlot(str) |
349 def on_nameEdit_textChanged(self, txt): |
478 def on_nameEdit_textChanged(self, txt): |
350 """ |
479 """ |
351 Private slot to check, if the nameEdit field is empty. |
480 Private slot to check, if the nameEdit field is empty. |
352 |
481 |
353 @param txt text of the entry field (string) |
482 @param txt text of the entry field (string) |
354 """ |
483 """ |
355 self.__checkOK() |
484 self.__checkOK() |