Modules |
Files |
Inheritance Tree |
Inheritance Graph |
Name Index |
Config
File: Synopsis/UI/Qt/sourceeditsimple.py
1| # Form implementation generated from reading ui file 'sourceeditsimple.ui'
2| #
3| # Created: Tue Nov 12 01:20:05 2002
4| # by: The PyQt User Interface Compiler (pyuic)
5| #
6| # WARNING! All changes made in this file will be lost!
7|
8|
9| from qt import *
10|
11|
12| class SourceEditSimple(QDialog):
13| def __init__(self,parent = None,name = None,modal = 0,fl = 0):
14| QDialog.__init__(self,parent,name,modal,fl)
15|
16| if name == None:
17| self.setName("SourceEditSimple")
18|
19| self.resize(600,480)
20| self.setCaption(self.trUtf8("Edit Simple Rule"))
21|
22| SourceEditSimpleLayout = QVBoxLayout(self,11,6,"SourceEditSimpleLayout")
23|
24| self.TextLabel7 = QLabel(self,"TextLabel7")
25| self.TextLabel7.setText(self.trUtf8("Select the files you want to include in this rule:"))
26| SourceEditSimpleLayout.addWidget(self.TextLabel7)
27|
28| self.GroupBox3 = QGroupBox(self,"GroupBox3")
29| self.GroupBox3.setTitle(self.trUtf8("Files"))
30| self.GroupBox3.setColumnLayout(0,Qt.Vertical)
31| self.GroupBox3.layout().setSpacing(6)
32| self.GroupBox3.layout().setMargin(11)
33| GroupBox3Layout = QVBoxLayout(self.GroupBox3.layout())
34| GroupBox3Layout.setAlignment(Qt.AlignTop)
35|
36| self.FileList = QListView(self.GroupBox3,"FileList")
37| self.FileList.addColumn(self.trUtf8("Filename"))
38| self.FileList.setSelectionMode(QListView.Extended)
39| GroupBox3Layout.addWidget(self.FileList)
40|
41| Layout12 = QHBoxLayout(None,0,6,"Layout12")
42|
43| self.AddFilesButton = QPushButton(self.GroupBox3,"AddFilesButton")
44| self.AddFilesButton.setText(self.trUtf8("Add files"))
45| Layout12.addWidget(self.AddFilesButton)
46| spacer = QSpacerItem(140,0,QSizePolicy.Expanding,QSizePolicy.Minimum)
47| Layout12.addItem(spacer)
48|
49| self.MakeRelativeButton = QPushButton(self.GroupBox3,"MakeRelativeButton")
50| self.MakeRelativeButton.setEnabled(0)
51| self.MakeRelativeButton.setText(self.trUtf8("Make relative ... "))
52| QToolTip.add(self.MakeRelativeButton,self.trUtf8("Makes the selected files relative to a given directory, if they have absolute pathnames"))
53| Layout12.addWidget(self.MakeRelativeButton)
54|
55| self.RemoveFileButton = QPushButton(self.GroupBox3,"RemoveFileButton")
56| self.RemoveFileButton.setEnabled(0)
57| self.RemoveFileButton.setText(self.trUtf8("Remove from list"))
58| Layout12.addWidget(self.RemoveFileButton)
59| GroupBox3Layout.addLayout(Layout12)
60| SourceEditSimpleLayout.addWidget(self.GroupBox3)
61|
62| self.Frame3_2 = QFrame(self,"Frame3_2")
63| self.Frame3_2.setFrameShape(QFrame.HLine)
64| self.Frame3_2.setFrameShadow(QFrame.Sunken)
65| SourceEditSimpleLayout.addWidget(self.Frame3_2)
66|
67| Layout5 = QHBoxLayout(None,0,6,"Layout5")
68|
69| self.CancelButton = QPushButton(self,"CancelButton")
70| self.CancelButton.setText(self.trUtf8("Cancel"))
71| Layout5.addWidget(self.CancelButton)
72| spacer_2 = QSpacerItem(400,0,QSizePolicy.Expanding,QSizePolicy.Minimum)
73| Layout5.addItem(spacer_2)
74|
75| self.OkButton = QPushButton(self,"OkButton")
76| self.OkButton.setText(self.trUtf8("Ok"))
77| Layout5.addWidget(self.OkButton)
78| SourceEditSimpleLayout.addLayout(Layout5)
79|
80| self.connect(self.AddFilesButton,SIGNAL("clicked()"),self.AddFilesButton_clicked)
81| self.connect(self.MakeRelativeButton,SIGNAL("clicked()"),self.MakeRelativeButton_clicked)
82| self.connect(self.RemoveFileButton,SIGNAL("clicked()"),self.RemoveFileButton_clicked)
83| self.connect(self.FileList,SIGNAL("selectionChanged()"),self.FileList_selectionChanged)
84| self.connect(self.OkButton,SIGNAL("clicked()"),self.OkButton_clicked)
85| self.connect(self.CancelButton,SIGNAL("clicked()"),self.CancelButton_clicked)
86|
87| def AddFilesButton_clicked(self):
88|
89| names = QFileDialog.getOpenFileNames(
90| "Files (*.h *.hh *.hpp *.c *.cc *.cpp *.py *.idl)",
91| None,
92| self,
93| "select files dialog",
94| "Select the files to include in the rule:")
95| if names:
96| # Find existing names
97| existing = []
98| item = self.FileList.firstChild()
99| while item:
100| existing.append(str(item.text(0)))
101| item = item.nextSibling()
102| print existing
103| for name in names:
104| if str(name) not in existing:
105| QListViewItem(self.FileList, name)
106|
107|
108| def RemoveFileButton_clicked(self):
109|
110| item = self.FileList.firstChild()
111| while item:
112| next = item.nextSibling()
113| if self.FileList.isSelected(item):
114| self.FileList.takeItem(item)
115| item = next
116|
117|
118| def FileList_selectionChanged(self):
119|
120| item = self.FileList.firstChild()
121| while item:
122| if self.FileList.isSelected(item):
123| self.RemoveFileButton.setEnabled(1)
124| self.MakeRelativeButton.setEnabled(1)
125| return
126| item = item.nextSibling()
127| self.RemoveFileButton.setEnabled(0)
128| self.MakeRelativeButton.setEnabled(0)
129|
130|
131| def MakeRelativeButton_clicked(self):
132|
133| import string, os
134| base = QFileDialog.getExistingDirectory(None, self, "getdir", "Select relative directory", 1)
135| if base:
136| base = str(base)
137| if base and base[-1] != '/': base = base + '/'
138| files = []
139| item = self.FileList.firstChild()
140| while item:
141| if self.FileList.isSelected(item):
142| file = str(item.text(0))
143| file = self.make_relative(base, file)
144| item.setText(0, file)
145| item = item.nextSibling()
146|
147|
148| def OkButton_clicked(self):
149|
150| self.accept()
151|
152|
153| def CancelButton_clicked(self):
154|
155| self.reject()
156|