Changeset 113
- Timestamp:
- Thu Apr 26 05:49:06 2007
- Files:
-
- branches/stable-1.8/WikidPadStarter.py (modified) (diff)
- branches/stable-1.8/extensions/WikiSyntax.py (modified) (diff)
- branches/stable-1.8/wikidpad_unicode.iss (modified) (diff)
- branches/stable-1.8/lib/pwiki/WikiTxtCtrl.py (modified) (diff)
- branches/stable-1.8/lib/pwiki/AdditionalDialogs.py (modified) (diff)
- branches/stable-1.8/lib/pwiki/DocPages.py (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
branches/stable-1.8/WikidPadStarter.py
r110 r113 4 4 os.stat_float_times(True) 5 5 6 VERSION_STRING = "wikidPad 1.8rc 3"6 VERSION_STRING = "wikidPad 1.8rc4" 6 6 7 7 if not hasattr(sys, 'frozen'): -
branches/stable-1.8/extensions/WikiSyntax.py
r99 r113 204 204 205 205 # script blocks 206 ScriptRE = re.compile(u"\<%(.*?)%\>", re.DOTALL) 206 # ScriptRE = re.compile(u"\<%(.*?)%\>", re.DOTALL) 207 ScriptRE = re.compile(u"\<%(?P<scriptContent>.*?)%\>", re.DOTALL) 207 208 208 209 # Auto generated area -
branches/stable-1.8/wikidpad_unicode.iss
r110 r113 39 39 SolidCompression=true 40 40 AppName=WikidPad 41 AppVerName=WikidPad 1.8rc 341 AppVerName=WikidPad 1.8rc4 41 41 DefaultDirName={pf}\WikidPad 42 42 DefaultGroupName=WikidPad 43 43 AppID={{22A83C29-58A8-4CAB-8EDC-918D74F8429E} 44 44 VersionInfoVersion=1.8 45 VersionInfoTextVersion=WikidPad 1.8rc 345 VersionInfoTextVersion=WikidPad 1.8rc4 45 45 LicenseFile=C:\DATEN\Projekte\Wikidpad\Current\license.txt 46 46 AllowNoIcons=true 47 47 ShowLanguageDialog=yes 48 48 Compression=lzma/ultra 49 OutputBaseFilename=WikidPad-1.8rc 349 OutputBaseFilename=WikidPad-1.8rc4 49 49 InternalCompressLevel=ultra 50 50 AppCopyright=© 2005-2007 Jason Horman, Michael Butscher, Gerhard Reitmayr -
branches/stable-1.8/lib/pwiki/WikiTxtCtrl.py
r105 r113 79 79 self.tfInput.SetBackgroundColour(IncrementalSearchDialog.COLOR_YELLOW) 80 80 mainsizer = wxBoxSizer(wxHORIZONTAL) 81 mainsizer.Add(self.tfInput, 1, wx .ALL | wx.EXPAND, 0)81 mainsizer.Add(self.tfInput, 1, wxALL | wxEXPAND, 0) 81 81 82 82 self.SetSizer(mainsizer) … … 916 916 917 917 cancopy = self.GetSelectionStart() != self.GetSelectionEnd() 918 918 918 918 item = self.contextMenu.FindItemById(GUI_ID.CMD_TEXT_DELETE) 919 if item: item.Enable(cancopy and self.CanPaste())919 if item: item.Enable(cancopy and not self.GetReadOnly()) 919 919 item = self.contextMenu.FindItemById(GUI_ID.CMD_CLIPBOARD_CUT) 920 if item: item.Enable(cancopy and self.CanPaste())920 if item: item.Enable(cancopy and not self.GetReadOnly()) 920 920 item = self.contextMenu.FindItemById(GUI_ID.CMD_CLIPBOARD_COPY) 921 921 if item: item.Enable(cancopy) … … 1228 1228 return 1229 1229 1230 SCRIPTFORMAT = WikiFormatting.FormatTypes.Script 1230 1231 # it is important to python to have consistent eol's 1231 1232 self.ConvertEOLs(self.eolMode) … … 1236 1237 # Execute all or selected script blocks on the page (or other 1237 1238 # related pages) 1239 1240 pageAst = self.getPageAst() 1241 scriptTokens = pageAst.findTypeFlat(SCRIPTFORMAT) 1238 1242 1239 # get the text of the current page 1240 text = self.GetText() 1243 # # get the text of the current page 1244 # text = self.GetText() 1241 1245 1242 1246 # process script imports … … 1244 1248 if self.loadedDocPage.getProperties().has_key( 1245 1249 "import_scripts"): 1246 scripts = self.loadedDocPage.getProperties()[ 1250 scriptNames = self.loadedDocPage.getProperties()[ 1246 1250 "import_scripts"] 1247 for s cript in scripts:1251 for sn in scriptNames: 1247 1251 try: 1248 1252 importPage = self.presenter.getWikiDocument().\ 1249 getWikiPage(script) 1250 content = importPage.getLiveText() 1251 text += "\n" + content 1253 getWikiPage(sn) 1254 pageAst = importPage.getLivePageAst() 1255 scriptTokens += pageAst.findTypeFlat(SCRIPTFORMAT) 1256 1257 # content = importPage.getLiveText() 1258 # text += "\n" + content 1252 1259 except: 1253 1260 pass 1254 1261 1255 1262 if securityLevel > 2: # global.import_scripts property also allowed 1256 glob script= self.presenter.getWikiDocument().getWikiData().\1263 globScriptName = self.presenter.getWikiDocument().getWikiData().\ 1256 1263 getGlobalProperties().get("global.import_scripts") 1257 1264 1258 if glob scriptis not None:1265 if globScriptName is not None: 1258 1265 try: 1259 1266 importPage = self.presenter.getWikiDocument().\ 1260 getWikiPage(globscript) 1261 content = importPage.getLiveText() 1262 text += "\n" + content 1267 getWikiPage(globScriptName) 1268 pageAst = importPage.getLivePageAst() 1269 scriptTokens += pageAst.findTypeFlat(SCRIPTFORMAT) 1270 # content = importPage.getLiveText() 1271 # text += "\n" + content 1263 1272 except: 1264 1273 pass 1265 1274 1266 match = WikiFormatting.ScriptRE.search(text) 1267 while(match): 1268 script = re.sub(u"^[\r\n\s]+", "", match.group(1)) 1269 script = re.sub(u"[\r\n\s]+$", "", script) 1275 for st in scriptTokens: 1276 script = st.grpdict["scriptContent"] 1277 script = re.sub(u"^[\r\n\s]+", u"", script) 1278 script = re.sub(u"[\r\n\s]+$", u"", script) 1270 1279 try: 1271 1280 if index == -1: … … 1285 1294 traceback.print_exc(file=s) 1286 1295 self.AddText(u"\nException: %s" % s.getvalue()) 1296 1287 1297 1288 match = WikiFormatting.ScriptRE.search(text, match.end()) 1298 1299 1300 # match = WikiFormatting.ScriptRE.search(text) 1301 # while(match): 1302 # script = re.sub(u"^[\r\n\s]+", "", match.group(1)) 1303 # script = re.sub(u"[\r\n\s]+$", "", script) 1304 # try: 1305 # if index == -1: 1306 # script = re.sub(u"^\d:?\s?", u"", script) 1307 # exec(script) in self.evalScope 1308 # elif index > -1 and script.startswith(str(index)): 1309 # script = re.sub(u"^\d:?\s?", u"", script) 1310 # exec(script) in self.evalScope 1311 # break # Execute only the first found script 1312 # 1313 # except Exception, e: 1314 # s = StringIO() 1315 # traceback.print_exc(file=s) 1316 # self.AddText(u"\nException: %s" % s.getvalue()) 1317 # 1318 # match = WikiFormatting.ScriptRE.search(text, match.end()) 1289 1319 else: 1290 1320 # Evaluate selected text … … 1294 1324 "eval", CO_FUTURE_DIVISION) 1295 1325 result = eval(compThunk, self.evalScope) 1296 # result = eval(re.sub(u"[\n\r]", u"", text), self.evalScope)1297 1326 except Exception, e: 1298 1327 s = StringIO() … … 1306 1335 1307 1336 1337 1338 # 1339 # def evalScriptBlocks(self, index=-1): 1340 # """ 1341 # Evaluates scripts. Respects "script_security_level" option 1342 # """ 1343 # securityLevel = self.presenter.getConfig().getint( 1344 # "main", "script_security_level") 1345 # if securityLevel == 0: 1346 # # No scripts allowed 1347 # # Print warning message 1348 # wxMessageBox(u"Set in options, page \"Security\", \n" 1349 # "item \"Script security\" an appropriate value \n" 1350 # "to execute a script", u"Script execution disabled", 1351 # wxOK, self.presenter.getMainControl()) 1352 # return 1353 # 1354 # # it is important to python to have consistent eol's 1355 # self.ConvertEOLs(self.eolMode) 1356 # (startPos, endPos) = self.GetSelection() 1357 # 1358 # # if no selection eval all scripts 1359 # if startPos == endPos or index > -1: 1360 # # Execute all or selected script blocks on the page (or other 1361 # # related pages) 1362 # 1363 # # get the text of the current page 1364 # text = self.GetText() 1365 # 1366 # # process script imports 1367 # if securityLevel > 1: # Local import_scripts properties allowed 1368 # if self.loadedDocPage.getProperties().has_key( 1369 # "import_scripts"): 1370 # scripts = self.loadedDocPage.getProperties()[ 1371 # "import_scripts"] 1372 # for script in scripts: 1373 # try: 1374 # importPage = self.presenter.getWikiDocument().\ 1375 # getWikiPage(script) 1376 # content = importPage.getLiveText() 1377 # text += "\n" + content 1378 # except: 1379 # pass 1380 # 1381 # if securityLevel > 2: # global.import_scripts property also allowed 1382 # globscript = self.presenter.getWikiDocument().getWikiData().\ 1383 # getGlobalProperties().get("global.import_scripts") 1384 # 1385 # if globscript is not None: 1386 # try: 1387 # importPage = self.presenter.getWikiDocument().\ 1388 # getWikiPage(globscript) 1389 # content = importPage.getLiveText() 1390 # text += "\n" + content 1391 # except: 1392 # pass 1393 # 1394 # match = WikiFormatting.ScriptRE.search(text) 1395 # while(match): 1396 # script = re.sub(u"^[\r\n\s]+", "", match.group(1)) 1397 # script = re.sub(u"[\r\n\s]+$", "", script) 1398 # try: 1399 # if index == -1: 1400 # script = re.sub(u"^\d:?\s?", u"", script) 1401 # exec(script) in self.evalScope 1402 # elif index > -1 and script.startswith(str(index)): 1403 # script = re.sub(u"^\d:?\s?", u"", script) 1404 # exec(script) in self.evalScope 1405 # break # Execute only the first found script 1406 # 1407 # except Exception, e: 1408 # s = StringIO() 1409 # traceback.print_exc(file=s) 1410 # self.AddText(u"\nException: %s" % s.getvalue()) 1411 # 1412 # match = WikiFormatting.ScriptRE.search(text, match.end()) 1413 # else: 1414 # # Evaluate selected text 1415 # text = self.GetSelectedText() 1416 # try: 1417 # compThunk = compile(re.sub(u"[\n\r]", u"", text), "<string>", 1418 # "eval", CO_FUTURE_DIVISION) 1419 # result = eval(compThunk, self.evalScope) 1420 # # result = eval(re.sub(u"[\n\r]", u"", text), self.evalScope) 1421 # except Exception, e: 1422 # s = StringIO() 1423 # traceback.print_exc(file=s) 1424 # result = s.getvalue() 1425 # 1426 # pos = self.GetCurrentPos() 1427 # self.GotoPos(endPos) 1428 # self.AddText(u" = %s" % unicode(result)) 1429 # self.GotoPos(pos) 1430 1431 1308 1432 def cleanAutoGenAreas(self, text): 1309 1433 """ -
branches/stable-1.8/lib/pwiki/AdditionalDialogs.py
r99 r113 947 947 948 948 if self.pWiki.getWikiData().isDefinedWikiWord(delword): 949 self.pWiki.getWikiData().deleteWord(delword) 949 page = self.pWiki.getWikiDocument().getWikiPage(delword) 950 page.deletePage() 951 952 # self.pWiki.getWikiData().deleteWord(delword) 950 953 951 954 # trigger hooks 952 955 self.pWiki.hooks.deletedWikiWord(self.pWiki, delword) 953 956 954 p2 = {} 955 p2["deleted page"] = True 956 p2["deleted wiki page"] = True 957 p2["wikiWord"] = delword 958 self.pWiki.fireMiscEventProps(p2) 957 # p2 = {} 958 # p2["deleted page"] = True 959 # p2["deleted wiki page"] = True 960 # p2["wikiWord"] = delword 961 # self.pWiki.fireMiscEventProps(p2) 959 962 960 963 self.pWiki.pageHistory.goAfterDeletion() -
branches/stable-1.8/lib/pwiki/DocPages.py
r102 r113 305 305 306 306 307 def getLivePageAst(self): 308 pageAst = None 309 txtEditor = self.getTxtEditor() 310 if txtEditor is not None: 311 # page is in text editor(s), so call AppendText on one of it 312 pageAst = txtEditor.getPageAst() 313 314 if pageAst is not None: 315 return pageAst 316 317 formatting = self.wikiDocument.getFormatting() 318 319 pageAst = PageAst.Page() 320 text = self.getLiveText() 321 pageAst.buildAst(formatting, text, self.getFormatDetails()) 322 323 return pageAst 324 325 307 326 def isDefined(self): 308 327 return self.getWikiData().isDefinedWikiWord(self.getWikiWord()) … … 615 634 616 635 617 # TODO Remove aliases? 618 def _flatTreeHelper(self, page, deepness, excludeSet, result): 636 def _flatTreeHelper(self, page, deepness, excludeSet, result, unalias): 619 637 """ 620 638 Recursive part of getFlatTree 621 639 """ 622 children = page.getChildRelationshipsTreeOrder(existingonly=True, 623 excludeSet=excludeSet) 624 625 subExcludeSet = excludeSet.copy() 626 # subExcludeSet.add(page.getWikiWord()) 627 subExcludeSet.union_update(children) 640 excludeSet.add(page.getNonAliasPage().getWikiWord()) 641 children = page.getChildRelationshipsTreeOrder(existingonly=True) 642 628 643 for c in children: 629 644 subpage = self.wikiDocument.getWikiPage(c) 630 result.append((c, deepness + 1)) 631 self._flatTreeHelper(subpage, deepness + 1, subExcludeSet, result) 645 nonAliasWord = subpage.getNonAliasPage().getWikiWord() 646 if nonAliasWord in excludeSet: 647 continue 648 if unalias: 649 result.append((nonAliasWord, deepness + 1)) 650 else: 651 result.append((c, deepness + 1)) 652 self._flatTreeHelper(subpage, deepness + 1, excludeSet, result, 653 unalias) 654 632 655 633 656 634 def getFlatTree(self): 657 def getFlatTree(self, unalias=False): 634 657 """ 635 658 Returns a sequence of tuples (word, deepness) where the current 636 659 word is the first one with deepness 0. 660 The words may contain aliases, but no word appears twice neither 661 will both a word and its alias appear in the list. 662 unalias -- replace all aliases by their real word 637 663 TODO EXPLAIN FUNCTION !!! 638 664 """ 639 result = [(self.getWikiWord(), 0)] 640 excludeSet = sets.Set((self.getWikiWord(),)) 641 642 self._flatTreeHelper(self, 0, excludeSet, result) 665 if unalias: 666 result = [(self.getNonAliasPage().getWikiWord(), 0)] 667 else: 668 result = [(self.getWikiWord(), 0)] 669 670 excludeSet = sets.Set() 671 self._flatTreeHelper(self, 0, excludeSet, result, unalias) 643 672 644 673 return result
