RefactoringRope/ConfigurationPage/MouseClickHandlerRopePage.py

Thu, 10 Jan 2019 14:21:07 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 10 Jan 2019 14:21:07 +0100
changeset 302
2e853e2f2430
parent 245
75a35a927952
child 320
91b171fdd85f
permissions
-rw-r--r--

Updated copyright for 2019.

129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
302
2e853e2f2430 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Rope Mouse Click Handler configuration page.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
151
5260100b6700 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
10 from __future__ import unicode_literals
5260100b6700 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
11
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from Preferences.ConfigurationPages.ConfigurationPageBase import \
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 ConfigurationPageBase
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from .Ui_MouseClickHandlerRopePage import Ui_MouseClickHandlerRopePage
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from Utilities import MouseUtilities
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from Preferences.MouseClickDialog import MouseClickDialog
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 class MouseClickHandlerRopePage(ConfigurationPageBase,
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Ui_MouseClickHandlerRopePage):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Class implementing the Rope Mouse Click Handler configuration page.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 def __init__(self, plugin):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param plugin reference to the plugin object
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @type RefactoringRopePlugin
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 ConfigurationPageBase.__init__(self)
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.setupUi(self)
132
5384651b27c7 Fixed an issue in the mouse click configuration page causing a wrong object name being set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 129
diff changeset
37 self.setObjectName("MouseClickHandlerRopePage")
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.__plugin = plugin
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 # set initial values
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.__modifiers = {
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 "goto": (
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__plugin.getPreferences("MouseClickGotoModifiers"),
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__plugin.getPreferences("MouseClickGotoButton")
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 )
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 }
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.ropeClickHandlerCheckBox.setChecked(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.__plugin.getPreferences("MouseClickEnabled"))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.gotoClickEdit.setText(MouseUtilities.MouseButtonModifier2String(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 *self.__modifiers["goto"]))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 def save(self):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 Public slot to save the Rope Mouse Click Handler configuration.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
58 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
59 "MouseClickEnabled",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.ropeClickHandlerCheckBox.isChecked())
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
61 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
62 "MouseClickGotoModifiers",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 int(self.__modifiers["goto"][0]))
133
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
64 self.__plugin.setPreferences(
6fb6ac582a39 Adjusted to slightly extended Editor API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 132
diff changeset
65 "MouseClickGotoButton",
129
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 int(self.__modifiers["goto"][1]))
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 @pyqtSlot()
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def on_changeGotoButton_clicked(self):
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Private slot to change the 'goto' mouse click sequence.
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 dlg = MouseClickDialog(*self.__modifiers["goto"])
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 if dlg.exec_() == QDialog.Accepted:
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.__modifiers["goto"] = dlg.getClick()
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.gotoClickEdit.setText(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 MouseUtilities.MouseButtonModifier2String(
23ee57a96ea3 Added capability to go to the definition of a class or function by clicking on it (while holding the Ctrl key or another configurable modifier sequence) (needs eric 6.1.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 *self.__modifiers["goto"]))

eric ide

mercurial