eric6/Plugins/WizardPlugins/DotDesktopWizard/DotDesktopWizardDialog.py

Tue, 02 Mar 2021 17:17:09 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 02 Mar 2021 17:17:09 +0100
changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
permissions
-rw-r--r--

Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.

6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2013 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the .desktop wizard dialog.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui.E5Application import e5App
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui import E5MessageBox
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_DotDesktopWizardDialog import Ui_DotDesktopWizardDialog
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 import Utilities
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 import UI.PixmapCache
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 class DotDesktopWizardDialog(QDialog, Ui_DotDesktopWizardDialog):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Class implementing the .desktop wizard dialog.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 def __init__(self, parent=None):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param parent reference to the parent widget (QWidget)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 super(DotDesktopWizardDialog, self).__init__(parent)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setupUi(self)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
37 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
38 QDialogButtonBox.StandardButton.Ok).setEnabled(False)
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.__mainCategories = [
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 'AudioVideo', 'Audio', 'Video', 'Development', 'Education',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 'Game', 'Graphics', 'Network', 'Office', 'Science', 'Settings',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 'System', 'Utility',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 ]
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.__subCategories = [
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 'Building', 'Debugger', 'IDE', 'GUIDesigner', 'Profiling',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 'RevisionControl', 'Translation', 'Calendar', 'ContactManagement',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 'Database', 'Dictionary', 'Chart', 'Email', 'Finance', 'FlowChart',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 'PDA', 'ProjectManagement', 'Presentation', 'Spreadsheet',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 'WordProcessor', '2DGraphics', 'VectorGraphics', 'RasterGraphics',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 '3DGraphics', 'Scanning', 'OCR', 'Photography', 'Publishing',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 'Viewer', 'TextTools', 'DesktopSettings', 'HardwareSettings',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 'Printing', 'PackageManager', 'Dialup', 'InstantMessaging', 'Chat',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 'IRCClient', 'Feed', 'FileTransfer', 'HamRadio', 'News', 'P2P',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 'RemoteAccess', 'Telephony', 'TelephonyTools', 'VideoConference',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 'WebBrowser', 'WebDevelopment', 'Midi', 'Mixer', 'Sequencer',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 'Tuner', 'TV', 'AudioVideoEditing', 'Player', 'Recorder',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 'DiscBurning', 'ActionGame', 'AdventureGame', 'ArcadeGame',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 'BoardGame', 'BlocksGame', 'CardGame', 'KidsGame', 'LogicGame',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 'RolePlaying', 'Shooter', 'Simulation', 'SportsGame',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 'StrategyGame', 'Art', 'Construction', 'Music', 'Languages',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 'ArtificialIntelligence', 'Astronomy', 'Biology', 'Chemistry',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 'ComputerScience', 'DataVisualization', 'Economy', 'Electricity',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 'Geography', 'Geology', 'Geoscience', 'History', 'Humanities',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 'ImageProcessing', 'Literature', 'Maps', 'Math',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 'NumericalAnalysis', 'MedicalSoftware', 'Physics', 'Robotics',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 'Spirituality', 'Sports', 'ParallelComputing', 'Amusement',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 'Archiving', 'Compression', 'Electronics', 'Emulator',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 'Engineering', 'FileTools', 'FileManager', 'TerminalEmulator',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 'Filesystem', 'Monitor', 'Security', 'Accessibility', 'Calculator',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 'Clock', 'TextEditor', 'Documentation', 'Adult', 'Core', 'KDE',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 'GNOME', 'XFCE', 'GTK', 'Qt', 'Motif', 'Java', 'ConsoleOnly',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 ]
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__showinEnvironments = [
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 'GNOME', 'KDE', 'LXDE', 'LXQt', 'MATE', 'Razor', 'ROX', 'TDE',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 'Unity', 'XFCE', 'EDE', 'Cinnamon', 'Pantheon', 'Old',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 ]
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.typeComboBox.addItems([
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.tr("FreeDesktop Standard .desktop"),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.tr("KDE Plasma MetaData .desktop"),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.tr("Ubuntu Unity QuickList .desktop"),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 ])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.kdeCategoryComboBox.addItems([
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 '', 'Application Launchers', 'Accessibility', 'Astronomy',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 'Date and Time', 'Development Tools', 'Education', 'Environment',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 'Examples', 'File System', 'Fun and Games', 'Graphics',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 'Language', 'Mapping', 'Multimedia', 'Online Services',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 'System Information', 'Utilities', 'Windows and Tasks',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 'Miscelaneous',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 ])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.kdeApiComboBox.addItems([
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 'Python', 'Javascript', 'Ruby', 'C++', 'HTML5', 'QML'
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 ])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 self.kdeEncodingComboBox.addItems(sorted(Utilities.supportedCodecs))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.kdeEncodingComboBox.setCurrentIndex(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.kdeEncodingComboBox.findText("utf-8"))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 projectOpen = e5App().getObject("Project").isOpen()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.projectButton.setEnabled(projectOpen)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
107 icon = UI.PixmapCache.getIcon("listSelection")
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.categoriesButton.setIcon(icon)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.onlyShowButton.setIcon(icon)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.notShowButton.setIcon(icon)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 def getCode(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 Public method to get the source code.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 @return generated code (string)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 # step 1: standard desktop entries
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 code = [
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 '[Desktop Entry]',
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 'Type=' + self.typeEdit.text(),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 ]
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 if self.versionEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 code.append('Version=' + self.versionEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 code.append('Name=' + self.nameEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if self.genericNameEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 code.append('GenericName=' + self.genericNameEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 if self.commentEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 code.append('Comment=' + self.commentEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 if self.iconFileEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 code.append('Icon=' + self.iconFileEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 if self.onlyShowEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 code.append('OnlyShowIn=' + self.onlyShowEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 if self.notShowEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 code.append('NotShowIn=' + self.notShowEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 if self.tryExecEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 code.append('TryExec=' + self.tryExecEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 if self.execEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 code.append('Exec=' + self.execEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 if self.pathEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 code.append('Path=' + self.pathEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 if self.terminalCheckBox.isChecked():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 code.append('Terminal=true')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 if self.actionsEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 code.append('Actions=' + self.actionsEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 if self.mimetypeEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 code.append('MimeType=' + self.mimetypeEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 if self.categoriesEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 code.append('Categories=' + self.categoriesEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 # step 2a: KDE Plasma entries
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 if self.typeComboBox.currentIndex() == 1:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 if self.kdeEncodingComboBox.currentText():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 code.append('Encoding=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 self.kdeEncodingComboBox.currentText())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 if self.kdeServiceTypeEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 code.append('ServiceTypes=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 self.kdeServiceTypeEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 if self.kdeApiComboBox.currentText():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 code.append('X-Plasma-API=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 self.kdeApiComboBox.currentText())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 if self.kdeMainScriptEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 code.append('X-Plasma-MainScript=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 self.kdeMainScriptEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 if self.kdeAuthorEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 code.append('X-KDE-PluginInfo-Author=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 self.kdeAuthorEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 if self.kdeEmailEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 code.append('X-KDE-PluginInfo-Email=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self.kdeEmailEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 if self.kdeNameEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 code.append('X-KDE-PluginInfo-Name=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 self.kdeNameEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 if self.kdeVersionEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 code.append('X-KDE-PluginInfo-Version=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 self.kdeVersionEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 if self.kdeWebsiteEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 code.append('X-KDE-PluginInfo-Website=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 self.kdeWebsiteEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 if self.kdeCategoryComboBox.currentText():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 code.append('X-KDE-PluginInfo-Category=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 self.kdeCategoryComboBox.currentText())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 if self.kdeDependsEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 code.append('X-KDE-PluginInfo-Depends=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.kdeDependsEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 if self.kdeLicensEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 code.append('X-KDE-PluginInfo-License=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.kdeLicensEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 if self.kdeEnabledDefaultCheckBox.isChecked():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 code.append('X-KDE-PluginInfo-EnabledByDefault=true')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 # step 2b: Unity entries
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 if self.typeComboBox.currentIndex() == 2:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 if self.unityShortcutsEdit.text():
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 code.append('X-Ayatana-Desktop-Shortcuts=' +
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 self.unityShortcutsEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 # step 3: action entries
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 actions = [act for act in self.actionsEdit.text().split(";") if act]
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 for act in actions:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 code.append('')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 code.append('[Desktop Action {0}]'.format(act))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 code.append('Name={0}'.format(act))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 code.append('Icon=<Icon Path>')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 code.append('Exec=<Executable command>')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 # step 4: add empty last line
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 code.append('')
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 return os.linesep.join(code)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 def __checkOK(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 Private slot to check, if the OK button should be enabled.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 enable = bool(self.nameEdit.text()) and bool(self.typeEdit.text())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 enable = False
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
219 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
220 QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 @pyqtSlot(int)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 def on_typeComboBox_currentIndexChanged(self, index):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 Private slot to handle a change of the .desktop type.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 @param index index of the selected entry (integer)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 self.dataTabWidget.setTabEnabled(1, index == 1)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 self.dataTabWidget.setTabEnabled(2, index == 2)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 @pyqtSlot()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 def on_projectButton_clicked(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 Private slot to populate some fields with data retrieved from the
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 current project.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 project = e5App().getObject("Project")
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 self.nameEdit.setText(project.getProjectName())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 self.genericNameEdit.setText(project.getProjectName())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.kdeNameEdit.setText(project.getProjectName())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 try:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 self.kdeVersionEdit.setText(project.getProjectVersion())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 self.kdeAuthorEdit.setText(project.getProjectAuthor())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 self.kdeEmailEdit.setText(project.getProjectAuthorEmail())
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 except AttributeError:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 self.kdeVersionEdit.setText(project.pdata["VERSION"][0])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 self.kdeAuthorEdit.setText(project.pdata["AUTHOR"][0])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 self.kdeEmailEdit.setText(project.pdata["EMAIL"][0])
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 mainscript = project.getMainScript(True)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 if mainscript:
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 self.kdeMainScriptEdit.setText(mainscript)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 self.execEdit.setText(mainscript)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 self.tryExecEdit.setText(mainscript)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 # prevent overwriting of entries by disabling the button
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 self.projectButton.setEnabled(False)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 @pyqtSlot()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 def on_categoriesButton_clicked(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 Private slot to select the categories.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 """
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
265 from .DotDesktopListSelectionDialog import (
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 DotDesktopListSelectionDialog
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
267 )
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 dlg = DotDesktopListSelectionDialog(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 self.__mainCategories,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 self.categoriesEdit.text(), ";",
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 subEntries=self.__subCategories,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 allowMultiMain=False)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
273 if dlg.exec() == QDialog.DialogCode.Accepted:
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 categories = dlg.getData(";", True)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 self.categoriesEdit.setText(categories)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 @pyqtSlot(str)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 def on_onlyShowEdit_textChanged(self, txt):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 Private slot to check the contents of the onlyShowEdit field.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 @param txt text of the entry field (string)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 self.__checkOK()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 E5MessageBox.critical(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 self,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 self.tr(".desktop Wizard"),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 self.tr("""Only one of 'Only Show In' or """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 """ 'Not Show In' allowed."""))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 @pyqtSlot()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 def on_onlyShowButton_clicked(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 Private slot to select the OnlyShowIn environments.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 """
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
297 from .DotDesktopListSelectionDialog import (
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 DotDesktopListSelectionDialog
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
299 )
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 dlg = DotDesktopListSelectionDialog(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 self.__showinEnvironments,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 self.onlyShowEdit.text(), ";")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
303 if dlg.exec() == QDialog.DialogCode.Accepted:
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 environments = dlg.getData(";", True)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 self.onlyShowEdit.setText(environments)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 @pyqtSlot(str)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 def on_notShowEdit_textChanged(self, txt):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 Private slot to check the contents of the notShowEdit field.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 @param txt text of the entry field (string)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 self.__checkOK()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 if bool(self.onlyShowEdit.text()) and bool(self.notShowEdit.text()):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 E5MessageBox.critical(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 self,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 self.tr(".desktop Wizard"),
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.tr("""Only one of 'Only Show In' or """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 """ 'Not Show In' allowed."""))
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 @pyqtSlot()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 def on_notShowButton_clicked(self):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 Private slot to select the NotShowIn environments.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
327 from .DotDesktopListSelectionDialog import (
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 DotDesktopListSelectionDialog
7258
aff39db4dacc Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
329 )
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 dlg = DotDesktopListSelectionDialog(
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 self.__showinEnvironments,
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.notShowEdit.text(), ";")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
333 if dlg.exec() == QDialog.DialogCode.Accepted:
6017
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 environments = dlg.getData(";", True)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 self.notShowEdit.setText(environments)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 @pyqtSlot(str)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 def on_typeEdit_textChanged(self, txt):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 Private slot to check, if the typeEdit field is empty.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 @param txt text of the entry field (string)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 self.__checkOK()
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 @pyqtSlot(str)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 def on_nameEdit_textChanged(self, txt):
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 Private slot to check, if the nameEdit field is empty.
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 @param txt text of the entry field (string)
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 """
dab01678626d Added the .desktop wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 self.__checkOK()

eric ide

mercurial