1069
1069
return self.debugProperties[key]
1071
def readTasks(self):
1073
Private method to read in the project tasks file (.e3t)
1075
if self.pfile is None:
1076
KQMessageBox.critical(None,
1077
self.trUtf8("Read tasks"),
1078
self.trUtf8("Please save the project first."),
1079
self.trUtf8("&Abort"))
1082
fn, ext = os.path.splitext(self.pfile)
1085
if ext.lower() == ".e3pz":
1087
if not os.path.exists(fn):
1092
KQMessageBox.critical(None,
1093
self.trUtf8("Read tasks"),
1094
self.trUtf8("""Compressed tasks files not supported. The compression library is missing."""),
1095
self.trUtf8("&Abort"),
1100
f = gzip.open(fn, "rb")
1103
if not os.path.exists(fn):
1107
dtdLine = f.readline()
1110
KQMessageBox.critical(None,
1111
self.trUtf8("Read tasks"),
1112
self.trUtf8("<p>The tasks file <b>%1</b> could not be read.</p>").arg(fn),
1113
self.trUtf8("&Abort"))
1117
if line.startswith('<?xml'):
1118
res = self.readXMLTasks(fn, dtdLine.startswith("<!DOCTYPE"))
1120
KQMessageBox.critical(None,
1121
self.trUtf8("Read project session"),
1122
self.trUtf8("<p>The tasks file <b>%1</b> has an unsupported format.</p>").arg(fn),
1123
self.trUtf8("&Abort"))
1125
def readXMLTasks(self, fn, validating):
1127
Public method to read the project tasks data from an XML file.
1129
@param fn filename of the project tasks file to be read (string or QString)
1130
@param validating flag indicating a validation of the XML file is
1133
parser = make_parser(validating)
1134
handler = TasksHandler(1)
1135
er = XMLEntityResolver()
1136
eh = XMLErrorHandler()
1138
parser.setContentHandler(handler)
1139
parser.setEntityResolver(er)
1140
parser.setErrorHandler(eh)
1143
if fn.lower().endswith("e3tz"):
1147
KQMessageBox.critical(None,
1148
self.trUtf8("Read tasks"),
1149
self.trUtf8("""Compressed tasks files not supported. The compression library is missing."""),
1150
self.trUtf8("&Abort"))
1152
f = gzip.open(fn, "rb")
1160
KQMessageBox.critical(None,
1161
self.trUtf8("Read tasks"),
1162
self.trUtf8("<p>The tasks file <b>%1</b> could not be read.</p>").arg(fn),
1163
self.trUtf8("&Abort"))
1164
except XMLFatalParseError:
1167
eh.showParseMessages()
1169
def writeTasks(self):
1171
Public method to write the tasks data to an XML file (.e3t).
1173
if self.pfile is None:
1176
fn, ext = os.path.splitext(self.pfile)
1179
if ext.lower() == ".e3pz":
1184
KQMessageBox.critical(None,
1185
self.trUtf8("Save tasks"),
1186
self.trUtf8("""Compressed tasks files not supported. The compression library is missing."""),
1187
self.trUtf8("&Abort"),
1192
f = gzip.open(fn, "wb")
1197
TasksWriter(f, 1, os.path.splitext(os.path.basename(fn))[0]).writeXML()
1202
KQMessageBox.critical(None,
1203
self.trUtf8("Save tasks"),
1204
self.trUtf8("<p>The tasks file <b>%1</b> could not be written.</p>")
1206
self.trUtf8("&Abort"))
1208
1071
def setDbgInfo(self, argv, wd, env, excReporting, excList, tracePython=None,
1209
1072
covexcPattern=None):
1822
def deleteDirectory(self, dn):
1824
Public slot to delete a directory from the project directory.
1826
@param dn directory name to be removed from the project
1827
@return flag indicating success
1830
if not os.path.isabs(dn):
1831
dn = os.path.join(self.ppath, dn)
1833
shutil.rmtree(dn, 1)
1835
KQMessageBox.critical(None,
1836
self.trUtf8("Delete directory"),
1837
self.trUtf8("<p>The selected directory <b>%1</b> could not be deleted.</p>")
1842
self.removeDirectory(dn)
1845
1685
def newProject(self):
1847
1687
Public slot to built a new project.
2267
2107
# now save the tasks
2268
2108
self.writeTasks()
2270
self.sourceExtensions = {\
2271
"Python" : ['.py', '.ptl'],
2273
"Mixed" : ['.py', '.ptl', '.rb']
2276
self.sourceFilters = {\
2277
"Python" : self.trUtf8(\
2278
"Python Files (*.py);;"
2279
"Quixote PTL Files (*.ptl);;"),
2280
"Ruby" : self.trUtf8("Ruby Files (*.rb);;"),
2281
"Mixed" : self.trUtf8(\
2282
"Python Files (*.py);;"
2283
"Quixote PTL Files (*.ptl);;"
2284
"Ruby Files (*.rb);;")
2288
["Qt", self.trUtf8("Qt")],
2289
["Kde", self.trUtf8("KDE")],
2290
["Console", self.trUtf8("Console")],
2291
["Other", self.trUtf8("Other")],
2295
2111
self.closeAct.setEnabled(0)
2296
2112
self.saveasAct.setEnabled(0)