5 |
5 |
6 """ |
6 """ |
7 Module implementing the refactoring interface to rope. |
7 Module implementing the refactoring interface to rope. |
8 """ |
8 """ |
9 |
9 |
|
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
|
11 |
10 import os |
12 import os |
11 import sys |
13 import sys |
12 |
14 |
13 sys.path.insert(0, os.path.dirname(__file__)) |
15 sys.path.insert(0, os.path.dirname(__file__)) |
|
16 if sys.version_info[0] >= 3: |
|
17 path = os.path.join(os.path.dirname(__file__), 'rope_py3') |
|
18 else: |
|
19 path = os.path.join(os.path.dirname(__file__), 'rope_py2') |
|
20 str = unicode |
|
21 |
|
22 sys.path.insert(0, path) |
14 import rope |
23 import rope |
15 import rope.base.libutils |
24 import rope.base.libutils |
16 import rope.base.exceptions |
25 import rope.base.exceptions |
17 |
26 |
18 from PyQt4.QtCore import QObject |
27 from PyQt4.QtCore import QObject |
686 """ the current one.</p>""" |
695 """ the current one.</p>""" |
687 )) |
696 )) |
688 self.updateConfigAct.triggered[()].connect( |
697 self.updateConfigAct.triggered[()].connect( |
689 self.__updateConfig) |
698 self.__updateConfig) |
690 self.actions.append(self.updateConfigAct) |
699 self.actions.append(self.updateConfigAct) |
691 |
|
692 for act in self.actions: |
|
693 act.setEnabled(False) |
|
694 |
700 |
695 def initMenu(self): |
701 def initMenu(self): |
696 """ |
702 """ |
697 Public slot to initialize the refactoring menu. |
703 Public slot to initialize the refactoring menu. |
698 |
704 |
2032 """ |
2038 """ |
2033 Private slot to show help about the refactorings offered by Rope. |
2039 Private slot to show help about the refactorings offered by Rope. |
2034 """ |
2040 """ |
2035 if self.__helpDialog is None: |
2041 if self.__helpDialog is None: |
2036 from HelpDialog import HelpDialog |
2042 from HelpDialog import HelpDialog |
|
2043 if sys.version_info[0] >= 3: |
|
2044 dir = 'rope_py3' |
|
2045 else: |
|
2046 dir = 'rope_py2' |
2037 helpfile = os.path.join(os.path.dirname(__file__), |
2047 helpfile = os.path.join(os.path.dirname(__file__), |
2038 "rope", "docs", "overview.txt") |
2048 dir, "rope", "docs", "overview.txt") |
2039 self.__helpDialog = \ |
2049 self.__helpDialog = \ |
2040 HelpDialog(self.trUtf8("Help about rope refactorings"), |
2050 HelpDialog(self.trUtf8("Help about rope refactorings"), |
2041 helpfile) |
2051 helpfile) |
2042 self.__helpDialog.show() |
2052 self.__helpDialog.show() |
2043 |
2053 |
2127 |
2137 |
2128 self.__projectopen = True |
2138 self.__projectopen = True |
2129 self.__projectpath = self.__e5project.getProjectPath() |
2139 self.__projectpath = self.__e5project.getProjectPath() |
2130 self.__projectLanguage = self.__e5project.getProjectLanguage() |
2140 self.__projectLanguage = self.__e5project.getProjectLanguage() |
2131 |
2141 |
2132 if self.__projectLanguage in ["Python3"]: |
2142 import rope.base.project |
2133 import rope.base.project |
2143 self.__project = rope.base.project.Project(self.__projectpath, |
2134 self.__project = rope.base.project.Project(self.__projectpath, |
2144 fscommands=self.__fsCommands) |
2135 fscommands=self.__fsCommands) |
|
2136 for act in self.actions: |
|
2137 act.setEnabled(True) |
|
2138 |
2145 |
2139 def projectClosed(self): |
2146 def projectClosed(self): |
2140 """ |
2147 """ |
2141 Public slot to handle the projectClosed signal. |
2148 Public slot to handle the projectClosed signal. |
2142 """ |
2149 """ |
2143 for act in self.actions: |
|
2144 act.setEnabled(False) |
|
2145 |
|
2146 if self.__project is not None: |
2150 if self.__project is not None: |
2147 self.__project.close() |
2151 self.__project.close() |
2148 self.__project = None |
2152 self.__project = None |
2149 |
2153 |
2150 self.__projectopen = False |
2154 self.__projectopen = False |