~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/Preferences/ConfigurationPages/DebuggerPythonPage.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (c) 2006 - 2007 Detlev Offenbach <detlev@die-offenbachs.de>
 
4
#
 
5
 
 
6
"""
 
7
Module implementing the Debugger Python configuration page.
 
8
"""
 
9
 
 
10
from PyQt4.QtCore import QDir, QString, pyqtSignature
 
11
 
 
12
from KdeQt import KQFileDialog
 
13
 
 
14
from E4Gui.E4Completers import E4FileCompleter
 
15
 
 
16
from ConfigurationPageBase import ConfigurationPageBase
 
17
from Ui_DebuggerPythonPage import Ui_DebuggerPythonPage
 
18
 
 
19
import Preferences
 
20
import Utilities
 
21
 
 
22
class DebuggerPythonPage(ConfigurationPageBase, Ui_DebuggerPythonPage):
 
23
    """
 
24
    Class implementing the Debugger Python configuration page.
 
25
    """
 
26
    def __init__(self):
 
27
        """
 
28
        Constructor
 
29
        """
 
30
        ConfigurationPageBase.__init__(self)
 
31
        self.setupUi(self)
 
32
        self.setObjectName("DebuggerPythonPage")
 
33
        
 
34
        self.interpreterCompleter = E4FileCompleter(self.interpreterEdit)
 
35
        self.debugClientCompleter = E4FileCompleter(self.debugClientEdit)
 
36
        
 
37
        # set initial values
 
38
        self.customPyCheckBox.setChecked(\
 
39
            Preferences.getDebugger("CustomPythonInterpreter"))
 
40
        self.interpreterEdit.setText(\
 
41
            Preferences.getDebugger("PythonInterpreter"))
 
42
        dct = Preferences.getDebugger("DebugClientType")
 
43
        if dct == "standard":
 
44
            self.standardButton.setChecked(True)
 
45
        elif dct == "threaded":
 
46
            self.threadedButton.setChecked(True)
 
47
        else:
 
48
            self.customButton.setChecked(True)
 
49
        self.debugClientEdit.setText(\
 
50
            Preferences.getDebugger("DebugClient"))
 
51
        self.pyRedirectCheckBox.setChecked(\
 
52
            Preferences.getDebugger("PythonRedirect"))
 
53
        self.pyNoEncodingCheckBox.setChecked(\
 
54
            Preferences.getDebugger("PythonNoEncoding"))
 
55
        
 
56
    def save(self):
 
57
        """
 
58
        Public slot to save the Debugger Python configuration.
 
59
        """
 
60
        Preferences.setDebugger("CustomPythonInterpreter", 
 
61
            int(self.customPyCheckBox.isChecked()))
 
62
        Preferences.setDebugger("PythonInterpreter", 
 
63
            self.interpreterEdit.text())
 
64
        if self.standardButton.isChecked():
 
65
            dct = "standard"
 
66
        elif self.threadedButton.isChecked():
 
67
            dct = "threaded"
 
68
        else:
 
69
            dct = "custom"
 
70
        Preferences.setDebugger("DebugClientType", dct)
 
71
        Preferences.setDebugger("DebugClient", 
 
72
            self.debugClientEdit.text())
 
73
        Preferences.setDebugger("PythonRedirect", 
 
74
            int(self.pyRedirectCheckBox.isChecked()))
 
75
        Preferences.setDebugger("PythonNoEncoding", 
 
76
            int(self.pyNoEncodingCheckBox.isChecked()))
 
77
        
 
78
    @pyqtSignature("")
 
79
    def on_interpreterButton_clicked(self):
 
80
        """
 
81
        Private slot to handle the Python interpreter selection.
 
82
        """
 
83
        file = KQFileDialog.getOpenFileName(\
 
84
            self,
 
85
            self.trUtf8("Select Python interpreter for Debug Client"),
 
86
            self.interpreterEdit.text(),
 
87
            QString())
 
88
            
 
89
        if not file.isEmpty():
 
90
            self.interpreterEdit.setText(\
 
91
                Utilities.toNativeSeparators(file))
 
92
        
 
93
    @pyqtSignature("")
 
94
    def on_debugClientButton_clicked(self):
 
95
        """
 
96
        Private slot to handle the Debug Client selection.
 
97
        """
 
98
        file = KQFileDialog.getOpenFileName(\
 
99
            None,
 
100
            self.trUtf8("Select Debug Client"),
 
101
            self.debugClientEdit.text(),
 
102
            self.trUtf8("Python Files (*.py)"))
 
103
            
 
104
        if not file.isEmpty():
 
105
            self.debugClientEdit.setText(\
 
106
                Utilities.toNativeSeparators(file))
 
107
    
 
108
def create(dlg):
 
109
    """
 
110
    Module function to create the configuration page.
 
111
    
 
112
    @param dlg reference to the configuration dialog
 
113
    """
 
114
    page = DebuggerPythonPage()
 
115
    return page