eric6/Templates/TemplatePropertiesDialog.py

Sun, 02 Feb 2020 11:04:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 02 Feb 2020 11:04:32 +0100
changeset 7380
c99320e859ca
parent 7360
9190402e4505
child 7775
4a1db75550bd
permissions
-rw-r--r--

Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
3 # Copyright (c) 2005 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the templates properties dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
10
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
11 from PyQt5.QtCore import QRegExp, Qt, pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
12 from PyQt5.QtGui import QRegExpValidator
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
13 from PyQt5.QtWidgets import QDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from .Ui_TemplatePropertiesDialog import Ui_TemplatePropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 108
diff changeset
17 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
3492
ae74a7201759 Added a configurable template code editor font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
19 import Preferences
ae74a7201759 Added a configurable template code editor font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
20
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
21
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 class TemplatePropertiesDialog(QDialog, Ui_TemplatePropertiesDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Class implementing the templates properties dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
26 def __init__(self, parent, groupMode=False, itm=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent the parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param groupMode flag indicating group mode (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param itm item (TemplateEntry or TemplateGroup) to
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 read the data from
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
35 super(TemplatePropertiesDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
3492
ae74a7201759 Added a configurable template code editor font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
38 self.templateEdit.setFont(Preferences.getTemplates("EditorFont"))
ae74a7201759 Added a configurable template code editor font.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
39
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 if not groupMode:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
41 self.nameEdit.setWhatsThis(self.tr(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """<b>Template name<b><p>Enter the name of the template."""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """ Templates may be autocompleted upon this name."""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """ In order to support autocompletion. the template name"""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 """ must only consist of letters (a-z and A-Z),"""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """ digits (0-9) and underscores (_).</p>"""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 ))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
48 self.__nameValidator = QRegExpValidator(QRegExp("[a-zA-Z0-9_]+"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.nameEdit)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.nameEdit.setValidator(self.__nameValidator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
52 import QScintilla.Lexers
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
53 self.languages = [("All", self.tr("All"))]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 supportedLanguages = QScintilla.Lexers.getSupportedLanguages()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 languages = sorted(supportedLanguages.keys())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 for language in languages:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.languages.append((language, supportedLanguages[language][0]))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.groupMode = groupMode
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 if groupMode:
5427
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
61 self.groupLabel.setText(self.tr("Language:"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 for lang, langDisp in self.languages:
5427
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
63 self.groupCombo.addItem(
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
64 QScintilla.Lexers.getLanguageIcon(lang, False),
614e88cfbd84 Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
65 langDisp)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.templateLabel.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.templateEdit.setEnabled(False)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
68 self.templateEdit.setPlainText(self.tr("GROUP"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.helpButton.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.descriptionLabel.hide()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.descriptionEdit.hide()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 groups = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 for group in parent.getGroupNames():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 groups.append(group)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.groupCombo.addItems(groups)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 if itm is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.nameEdit.setText(itm.getName())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 if groupMode:
5148
1a879f9af1c0 Fixed some code style issue detected by the new pycodestyle checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
81 language = itm.getLanguage()
1a879f9af1c0 Fixed some code style issue detected by the new pycodestyle checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
82 for lang, langDisp in self.languages:
1a879f9af1c0 Fixed some code style issue detected by the new pycodestyle checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
83 if language == lang:
1a879f9af1c0 Fixed some code style issue detected by the new pycodestyle checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
84 self.setSelectedGroup(langDisp)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.setSelectedGroup(itm.getGroupName())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.templateEdit.setPlainText(itm.getTemplateText())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.descriptionEdit.setText(itm.getDescription())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.nameEdit.selectAll()
4481
456c58fc64b0 Added a specialized dialog to show template help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
92
456c58fc64b0 Added a specialized dialog to show template help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
93 self.__helpDialog = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 def keyPressEvent(self, ev):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
97 Protected method to handle the user pressing the escape key.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 @param ev key event (QKeyEvent)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 if ev.key() == Qt.Key_Escape:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
102 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
103 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
104 self.tr("Close dialog"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
105 self.tr("""Do you really want to close the dialog?"""))
541
00e1a5d060c5 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
106 if not res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self.reject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 def on_helpButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
112 Private slot to show some help.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 """
4481
456c58fc64b0 Added a specialized dialog to show template help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
114 if self.__helpDialog is None:
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
115 from E5Gui.E5SimpleHelpDialog import E5SimpleHelpDialog
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
116 self.__helpDialog = E5SimpleHelpDialog(
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
117 title=self.tr("Template Help"),
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
118 label=self.tr("<b>Template Help</b>"),
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
119 helpStr=self.tr(
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
120 """<p>To use variables in a template, you just have to"""
5792
519a193a19d7 Fixed some typos in the templates help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5769
diff changeset
121 """ enclose the variable name with $-characters. When"""
519a193a19d7 Fixed some typos in the templates help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5769
diff changeset
122 """ you use the template, you will then be asked for a"""
519a193a19d7 Fixed some typos in the templates help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5769
diff changeset
123 """ value for this variable.</p>"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
124 """<p>Example template: This is a $VAR$</p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
125 """<p>When you use this template you will be prompted"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
126 """ for a value for the variable $VAR$. Any occurrences"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
127 """ of $VAR$ will then be replaced with whatever you've"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
128 """ entered.</p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
129 """<p>If you need a single $-character in a template,"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
130 """ which is not used to enclose a variable, type"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
131 """ $$(two dollar characters) instead. They will"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
132 """ automatically be replaced with a single $-character"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
133 """ when you use the template.</p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
134 """<p>If you want a variables contents to be treated"""
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
135 """ specially, the variable name must be followed by a"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
136 """ ':' and one formatting specifier (e.g. $VAR:ml$)."""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
137 """ The supported specifiers are:"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
138 """<table>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
139 """<tr><td>ml</td><td>Specifies a multiline formatting."""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
140 """ The first line of the variable contents is prefixed"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
141 """ with the string occurring before the variable on"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
142 """ the same line of the template. All other lines are"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
143 """ prefixed by the same amount of whitespace as the"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
144 """ line containing the variable."""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
145 """</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
146 """<tr><td>rl</td><td>Specifies a repeated line"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
147 """ formatting. Each line of the variable contents is"""
5792
519a193a19d7 Fixed some typos in the templates help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5769
diff changeset
148 """ prefixed with the string occurring before the"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
149 """ variable on the same line of the template."""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
150 """</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
151 """</table></p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
152 """<p>The following predefined variables may be used"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
153 """ in a template:"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
154 """<table>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
155 """<tr><td>date</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
156 """<td>today's date in ISO format (YYYY-MM-DD)</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
157 """<tr><td>year</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
158 """<td>the current year</td></tr>"""
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
159 """<tr><td>time</td>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
160 """<td>current time in ISO format (hh:mm:ss)</td></tr>"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
161 """<tr><td>project_name</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
162 """<td>the name of the project (if any)</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
163 """<tr><td>project_path</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
164 """<td>the path of the project (if any)</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
165 """<tr><td>path_name</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
166 """<td>full path of the current file</td></tr>"""
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
167 """<tr><td>path_name_rel</td>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
168 """<td>project relative path of the current file</td>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
169 """</tr>"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
170 """<tr><td>dir_name</td>"""
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
171 """<td>full path of the current file's directory</td>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
172 """</tr>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
173 """<tr><td>dir_name_rel</td>"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
174 """<td>project relative path of the current file's"""
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
175 """ directory</td></tr>"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
176 """<tr><td>file_name</td>"""
5794
f8cf9bcaa1fa Added some new predefined template variables (time, path_name_rel, dir_name_rel).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5792
diff changeset
177 """<td>the current file's name (without directory)"""
5769
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
178 """</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
179 """<tr><td>base_name</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
180 """<td>like <i>file_name</i>, but without extension"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
181 """</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
182 """<tr><td>ext</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
183 """<td>the extension of the current file</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
184 """<tr><td>cur_select</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
185 """<td>the currently selected text</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
186 """<tr><td>insertion</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
187 """<td>Sets insertion point for cursor after template is"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
188 """ inserted.</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
189 """</tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
190 """<tr><td>select_start</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
191 """<td>Sets span of selected text in template after"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
192 """ template is inserted (used together with"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
193 """ 'select_end').</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
194 """<tr><td>select_end</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
195 """<td>Sets span of selected text in template after"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
196 """ template is inserted (used together with"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
197 """ 'select_start')."""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
198 """</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
199 """<tr><td>clipboard</td>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
200 """<td>the text of the clipboard</td></tr>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
201 """</table></p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
202 """<p>If you want to change the default delimiter to"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
203 """ anything different, please use the configuration"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
204 """ dialog to do so.</p>"""
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
205 ),
944c04cec861 Added the capability to send these emails via Google Mail using OAuth2 authentication.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5427
diff changeset
206 parent=self)
4481
456c58fc64b0 Added a specialized dialog to show template help text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
207 self.__helpDialog.show()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 def setSelectedGroup(self, name):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 Public method to select a group.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 @param name name of the group to be selected (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 index = self.groupCombo.findText(name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 self.groupCombo.setCurrentIndex(index)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 def getData(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 Public method to get the data entered into the dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
222 @return a tuple of two strings (name, language), if the dialog is in
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
223 group mode, and a tuple of four strings (name, description, group
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
224 name, template) otherwise.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 if self.groupMode:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 return (self.nameEdit.text(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 self.languages[self.groupCombo.currentIndex()][0]
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
229 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 return (self.nameEdit.text(),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
232 self.descriptionEdit.text(),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 self.groupCombo.currentText(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 self.templateEdit.toPlainText()
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
235 )

eric ide

mercurial