|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Debugger Ruby configuration page. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import QDir, pyqtSlot |
|
11 from PyQt4.QtGui import QFileDialog |
|
12 |
|
13 from E4Gui.E4Completers import E4FileCompleter |
|
14 |
|
15 from ConfigurationPageBase import ConfigurationPageBase |
|
16 from Ui_DebuggerRubyPage import Ui_DebuggerRubyPage |
|
17 |
|
18 import Preferences |
|
19 import Utilities |
|
20 |
|
21 class DebuggerRubyPage(ConfigurationPageBase, Ui_DebuggerRubyPage): |
|
22 """ |
|
23 Class implementing the Debugger Ruby configuration page. |
|
24 """ |
|
25 def __init__(self): |
|
26 """ |
|
27 Constructor |
|
28 """ |
|
29 ConfigurationPageBase.__init__(self) |
|
30 self.setupUi(self) |
|
31 self.setObjectName("DebuggerRubyPage") |
|
32 |
|
33 self.rubyInterpreterCompleter = E4FileCompleter(self.rubyInterpreterEdit) |
|
34 |
|
35 # set initial values |
|
36 self.rubyInterpreterEdit.setText(\ |
|
37 Preferences.getDebugger("RubyInterpreter")) |
|
38 self.rbRedirectCheckBox.setChecked(\ |
|
39 Preferences.getDebugger("RubyRedirect")) |
|
40 |
|
41 def save(self): |
|
42 """ |
|
43 Public slot to save the Debugger Ruby configuration. |
|
44 """ |
|
45 Preferences.setDebugger("RubyInterpreter", |
|
46 self.rubyInterpreterEdit.text()) |
|
47 Preferences.setDebugger("RubyRedirect", |
|
48 int(self.rbRedirectCheckBox.isChecked())) |
|
49 |
|
50 @pyqtSlot() |
|
51 def on_rubyInterpreterButton_clicked(self): |
|
52 """ |
|
53 Private slot to handle the Ruby interpreter selection. |
|
54 """ |
|
55 file = QFileDialog.getOpenFileName(\ |
|
56 self, |
|
57 self.trUtf8("Select Ruby interpreter for Debug Client"), |
|
58 self.rubyInterpreterEdit.text()) |
|
59 |
|
60 if file: |
|
61 self.rubyInterpreterEdit.setText(\ |
|
62 Utilities.toNativeSeparators(file)) |
|
63 |
|
64 def create(dlg): |
|
65 """ |
|
66 Module function to create the configuration page. |
|
67 |
|
68 @param dlg reference to the configuration dialog |
|
69 """ |
|
70 page = DebuggerRubyPage() |
|
71 return page |