Changeset 129

Show
Ignore:
Timestamp:
Thu Sep 27 06:03:27 2007
Author:
mbutscher
Message:

branches/mbutscher/work:

* Optional shortcut to focus fast search field
* Options for timeline to suppress "empty" days and to sort

dates descending
* Options for timeline to switch off wiki page list on
hovering over date, instead showing it after clicking on
it is possible
* Larger default delays for autosave
* Option to set number of separator lines between wiki
pages in single HTML page output
* Possibility to set image size in percent
* Shortcuts "ActivateLink", "ActivateLinkNewTab" and
"ActivateLink2" now also work in incremental search mode

* Bug fixed: Updating wikis from WikidPad 1.1 failed
* Bug fixed: Source code did not work correctly with
wxPython 2.8 (OS not recognized properly)
* Bug fixed: Exception possible when running WikidPad from
commandline while doc structure window is open
* Bug fixed: Starting URLs with characters not in system
codepage failed
* Bug fixed: Wrong shortcuts shown in tooltips of toolbar
buttons

* Internal: Some inactive code added to support a deferred
database commit during idle time for sqlite dbs.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/mbutscher/work/ExceptionLogger.py

    r84 r129  
    4 4 class StdErrReplacement:  
    5 5     def write(self, data):  
    6           import ExceptionLogger as EL  
      6         try:  
      7             import ExceptionLogger as EL  
      8         except ImportError:  
      9             # This should only happen while interpreter shuts down  
      10             return  
    7 11 #         global _exceptionDestDir, _exceptionSessionTimeStamp, _exceptionOccurred  
    8 12 #         global _previousExcepthook  
  • branches/mbutscher/work/setup.py

    r115 r129  
    30 30       packages=['pwiki', 'pwiki.wikidata', 'pwiki.wikidata.compact_sqlite',  
    31 31                 'pwiki.wikidata.original_gadfly',  
    32                   'pwiki.wikidata.original_sqlite',  
      32                 'pwiki.wikidata.original_sqlite', 'pwiki.timeView',  
    32 32                 'pwiki.rtlibRepl'],  
    33 33       # py_modules=['encodings.utf_8', 'encodings.latin_1'],  
  • branches/mbutscher/work/WikidPad.xrc

    r127 r129  
    709 709         <flag>wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
    710 710       </object>  
      711       <object class="sizeritem">  
      712         <object class="wxBoxSizer">  
      713           <orient>wxHORIZONTAL</orient>  
      714           <object class="sizeritem">  
      715             <object class="wxStaticText">  
      716               <label>Single page separator lines:</label>  
      717             </object>  
      718             <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      719             <border>5</border>  
      720           </object>  
      721           <object class="sizeritem">  
      722             <object class="wxTextCtrl" name="tfHtmlExportSinglePageSepLineCount"/>  
      723             <option>1</option>  
      724             <flag>wxALL|wxEXPAND</flag>  
      725             <border>5</border>  
      726           </object>  
      727         </object>  
      728         <option>0</option>  
      729         <flag>wxTOP|wxLEFT|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      730       </object>  
    711 731     </object>  
    712 732   </object>  
     
    1471 1491         <border>5</border>  
    1472 1492       </object>  
      1493       <object class="sizeritem">  
      1494         <object class="wxCheckBox" name="cbTimeViewShowWordListOnHovering">  
      1495           <label>Show word list on hovering</label>  
      1496         </object>  
      1497         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1498         <border>5</border>  
      1499       </object>  
      1500       <object class="sizeritem">  
      1501         <object class="wxCheckBox" name="cbTimeViewShowWordListOnSelect">  
      1502           <label>Show word list on select</label>  
      1503         </object>  
      1504         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1505         <border>5</border>  
      1506       </object>  
      1507       <object class="sizeritem">  
      1508         <object class="wxStaticLine"/>  
      1509         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1510         <border>5</border>  
      1511       </object>  
      1512       <object class="sizeritem">  
      1513         <object class="wxStaticText" name="">  
      1514           <label>Timeline</label>  
      1515           <font>  
      1516             <style>default</style>  
      1517             <weight>bold</weight>  
      1518             <family>normal</family>  
      1519             <underlined>0</underlined>  
      1520           </font>  
      1521         </object>  
      1522         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1523         <border>5</border>  
      1524       </object>  
      1525       <object class="sizeritem">  
      1526         <object class="wxCheckBox" name="cbTimelineShowEmptyDays">  
      1527           <label>Show empty days</label>  
      1528         </object>  
      1529         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1530         <border>5</border>  
      1531       </object>  
      1532       <object class="sizeritem">  
      1533         <object class="wxCheckBox" name="cbTimelineSortDateAscending">  
      1534           <label>Sort dates ascending</label>  
      1535         </object>  
      1536         <flag>wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL</flag>  
      1537         <border>5</border>  
      1538       </object>  
    1473 1539     </object>  
    1474 1540   </object>  
  • branches/mbutscher/work/WikidPadStarter.py

    r127 r129  
    4 4 os.stat_float_times(True)  
    5 5  
    6   VERSION_STRING = "wikidPad 1.9beta10"  
      6 VERSION_STRING = "wikidPad 1.9beta11"  
    6 6  
    7 7 if not hasattr(sys, 'frozen'):  
  • branches/mbutscher/work/extensions/EvalLibrary.py

    r19 r129  
    1 1 from time import strftime  
    2   import pwiki.urllib_red as urllib  
      2 from pwiki.StringOps import urlFromPathname  
    2 2  
    3 3 def now():  
     
    22 22 def encodeSelection(editor):  
    23 23     text = editor.GetSelectedText()  
    24       url = urllib.pathname2url(text)  
      24     url = urlFromPathname(text)  
    24 24     editor.ReplaceSelection("file:%s" % url)  
  • branches/mbutscher/work/extensions/KeyBindings.py

    r126 r129  
    72 72 GoNextTab=""  
    73 73 GoPreviousTab=""  
      74 FocusFastSearchField=""  
      75  
      76  
    74 77  
    75 78 def makeBold(editor):  
  • branches/mbutscher/work/wikidpad_unicode.iss

    r127 r129  
    39 39 SolidCompression=true  
    40 40 AppName=WikidPad  
    41   AppVerName=WikidPad 1.9beta10  
      41 AppVerName=WikidPad 1.9beta11  
    41 41 DefaultDirName={pf}\WikidPad  
    42 42 DefaultGroupName=WikidPad  
    43 43 AppID={{22A83C29-58A8-4CAB-8EDC-918D74F8429E}  
    44 44 VersionInfoVersion=1.9  
    45   VersionInfoTextVersion=WikidPad 1.9beta10  
      45 VersionInfoTextVersion=WikidPad 1.9beta11  
    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.9beta10  
      49 OutputBaseFilename=WikidPad-1.9beta11  
    49 49 InternalCompressLevel=ultra  
    50 50 AppCopyright=© 2005-2007 Jason Horman, Michael Butscher, Gerhard Reitmayr  
  • branches/mbutscher/work/WikidPadHelp/data/Options HTML preview_export.wiki

    r121 r129  
    60 60 Set the title of the table of contents according to your language. The default is "Table of Contents". For German it could be e.g. "Inhaltsverzeichnis".  
    61 61  
      62 *Single page separator lines*  
      63 Set the number of separator lines to separate wiki pages in a single HTML page on export.  
      64  
      65  
    62 66  
    63 67 +++ HTML header settings  
  • branches/mbutscher/work/WikidPadHelp/data/UrlLinking.wiki

    r119 r129  
    39 39 To show all such URLs as links instead, open "Options" dialog, page "HTML preview/export" and check "Show pics as links in preview" or "Show pics as links in export" or set it temporarily in the export dialog.  
    40 40  
    41   For controlling of individual URLs, see next chapter.  
      41 For controlling of individual URLs, see "URL Appendix" below.  
    41 41  
    42 42  
     
    62 62     i Show URL as image, even if it has none of the default suffixes  
    63 63     l Show URL as link. 'i' and 'l' are mutually exclusive.  
    64       s Set size of an image, following the code is the width and height, delimited by 'x' (e.g. '200x300')  
      64     s Set size of an image, following the code is the width and height in pixels or  
      65       as percentage of space on page, delimited by 'x' (e.g. '200x300', "60%x70%")  
    65 66     a Set alignment of image, the following character defines which alignment (*t*op, vertically  
    66 67     *m*iddle, *b*ottom, *r*ight or *l*eft). This setting is not respected by the preview.  
  • branches/mbutscher/work/WikidPadHelp/data/OptionsDialog.wiki

    r126 r129  
    250 250 After selecting an item in time view, time view is hidden automatically.  
    251 251  
      252 *Show word list on hovering*  
      253 Should the list of related wiki words be shown when hovering over a date with mouse.  
      254  
      255 *Show word list on select*  
      256 Should the list of related wiki words be shown when selecting (clicking on) a date.  
      257  
      258 *Show empty days*  
      259 Should "empty" dates without relatzed wiki words be shown in the timeline.  
      260 This option can also be set in the context menu of the timeline.  
      261  
      262 *Show dates ascending*  
      263 Control if the dates in timeline should be sorted ascending or descending.  
      264 This option can also be set in the context menu of the timeline.  
      265  
    252 266  
    253 267 ++++ Searching  
  • branches/mbutscher/work/WikidPadHelp/data/ChangeLog.wiki

    r127 r129  
    1 1 ++ Change Log  
    2 2  
    3   Sep. 05, 2007 (1.9beta10)  
      3  
      4 Sep. 27, 2007 (1.9beta11)  
      5  
      6     * Optional shortcut to focus fast search field  
      7     * Options for timeline to suppress "empty" days and to sort  
      8       dates descending. See OptionsDialog#++++# Time# view  
      9     * Options for timeline to switch off wiki page list  
      10       on hovering over date, instead showing it after clicking  
      11       on it is possible. See OptionsDialog#++++# Time# view  
      12     * Option to set number of separator lines between wiki pages  
      13       in single HTML page output.  
      14       See [Options HTML preview_export]#*Single# page# separator# lines*  
      15     * Larger default delays for autosave  
      16     * Possibility to set image size in percent.  
      17       See UrlLinking#++# URL# Appendix  
      18     * Shortcuts "ActivateLink", "ActivateLinkNewTab" and  
      19       "ActivateLink2" now also work in incremental search mode  
      20      
      21     * Bug fixed: Updating wikis from WikidPad 1.1 failed  
      22     * Bug fixed: Source code did not work correctly with  
      23       wxPython 2.8 (OS not recognized properly)  
      24     * Bug fixed: Exception possible when running WikidPad from  
      25       commandline while doc structure window is open  
      26     * Bug fixed: Starting URLs with characters not in system  
      27       codepage failed  
      28     * Bug fixed: Wrong shortcuts shown in tooltips of toolbar  
      29       buttons  
      30  
      31  
      32  
      33 Sep. 05, 2007 (1.9beta10, repository revision in "mbutscher" branch: 127)  
    4 34  
    5 35     * Bug fixed: OS not recognized if using source version on  
     
    14 44  
    15 45  
    16   Aug. 28, 2007 (1.9beta9)  
      46 Aug. 28, 2007 (1.9beta9, repository revision in "mbutscher" branch: 126)  
    16 46  
    17 47     * Very basic support for a time view/timeline. Much work to do  
  • branches/mbutscher/work/lib/pwiki/WikiTxtCtrl.py

    r127 r129  
      1 ## import hotshot  
      2 ## _prof = hotshot.Profile("hotshot.prf")  
      3  
    1 4 import os, traceback, codecs, array  
    2 5 from cStringIO import StringIO  
     
    31 34 #        Tokenizer, wikiWordToLabel, revStr, lineendToInternal, lineendToOs  
    32 35  
    33   from Configuration import isUnicode, isWin9x  
      36 from Configuration import isUnicode, isWin9x, isLinux  
    33 36  
    34 37  
     
    163 166                 (wx.ACCEL_NORMAL, wx.WXK_PRIOR)):  
    164 167             foundPos = self.txtCtrl.executeIncrementalSearchBackward()  
      168         elif matchesAccelPair("ActivateLink", accP):  
      169             # ActivateLink is normally Ctrl-L  
      170             self.Close()  
      171             self.txtCtrl.activateLink()  
      172         elif matchesAccelPair("ActivateLinkNewTab", accP):  
      173             # ActivateLinkNewTab is normally Ctrl-Alt-L  
      174             self.Close()  
      175             self.txtCtrl.activateLink(tabMode=2)         
      176         elif matchesAccelPair("ActivateLink2", accP):  
      177             # ActivateLink2 is normally Ctrl-Return  
      178             self.Close()  
      179             self.txtCtrl.activateLink()  
    165 180         # handle the other keys  
    166 181         else:  
     
    204 219  
    205 220     def __init__(self, presenter, parent, ID):  
    206           wx.stc.StyledTextCtrl.__init__(self, parent, ID)  
      221         wx.stc.StyledTextCtrl.__init__(self, parent, ID, style=wx.WANTS_CHARS | wx.TE_PROCESS_ENTER)  
    206 221         self.presenter = presenter  
    207 222         self.evalScope = None  
     
    215 230         self.ignoreOnChange = False  
    216 231         self.searchStr = u""  
    217            
      232  
    217 232         # If autocompletion word was choosen, how many bytes to delete backward  
    218 233         # before inserting word  
     
    232 247         # editor settings  
    233 248         self.applyBasicSciSettings()  
    234            
      249  
    234 249         self.defaultFont = config.get("main", "font",  
    235 250                 self.presenter.getDefaultFontFaces()["mono"])  
     
    420 435         Close the editor (=prepare for destruction)  
    421 436         """  
      437         self.stylingThreadHolder.setThread(None)  
    422 438         self.unloadCurrentDocPage({})   # ?  
    423 439         self.presenterListener.disconnect()  
     
    715 731          
    716 732     def unloadCurrentDocPage(self, evtprops=None):  
      733         ## _prof.start()  
    717 734         # Unload current page  
    718 735         docPage = self.getLoadedDocPage()  
     
    741 758 #             self.pageAst = None  
    742 759             self.pageType = "normal"  
      760          
      761         ## _prof.stop()  
    743 762  
    744 763  
     
    1684 1703         else:  
    1685 1704             linkPos = self.GetCurrentPos()  
    1686    
      1705              
    1686 1705         pageAst = self.getPageAst()  
    1687 1706         linkCharPos = len(self.GetTextRange(0, linkPos))  
     
    2788 2807     def OnDropFiles(self, x, y, filenames):  
    2789 2808         urls = []  
    2790            
      2809  
    2790 2809         # Necessary because key state may change during the loop                                 
    2791 2810         controlPressed = wx.GetKeyState(wx.WXK_CONTROL)  
    2792 2811         shiftPressed = wx.GetKeyState(wx.WXK_SHIFT)  
    2793            
      2812  
    2793 2812         for fn in filenames:  
      2813             if isLinux():  
      2814                 # On Linux, at least Ubuntu, fn is a UTF-8 encoded unicode(!?)  
      2815                 # string  
      2816                 fn = utf8Dec(fn.encode("latin-1", "replace"))[0]  
      2817  
    2794 2818             url = urlFromPathname(fn)  
    2795 2819  
  • branches/mbutscher/work/lib/pwiki/Exporters.py

    r124 r129  
    23 23 import Configuration  
    24 24  
      25 import OsAbstract  
      26  
    25 27 import WikiFormatting  
    26 28 import DocPages  
     
    72 74  
    73 75         relUnAlias = self.wikiData.getAliasesWikiWord(word)  
    74           return self.htmlXmlExporter.convertFilename(u"%s.html" % relUnAlias)  
      76         return urlFromPathname(self.htmlXmlExporter.convertFilename(  
      77                 u"%s.html" % relUnAlias))  
    75 78  
    76 79  
     
    262 265         if self.mainControl.getConfig().getboolean(  
    263 266                 "main", "start_browser_after_export") and startfile:  
    264               if Configuration.isWindows():  
    265                    os.startfile(startfile)  
    266                   # os.startfile(mbcsEnc(link2, "replace")[0])  
    267               else:  
    268                   # Better solution?  
    269                   wx.LaunchDefaultBrowser(startfile)    # TODO  
      267             OsAbstract.startFile(startfile)  
      268 #             if Configuration.isWindows():  
      269 #                  os.startfile(startfile)  
      270 #                 # os.startfile(mbcsEnc(link2, "replace")[0])  
      271 #             else:  
      272 #                 # Better solution?  
      273 #                 wx.LaunchDefaultBrowser(startfile)    # TODO  
    270 274  
    271 275         self.tempFileSet.reset()  
     
    284 288  
    285 289     def _exportHtmlSingleFile(self):  
      290         config = self.mainControl.getConfig()  
      291         sepLineCount = config.getint("main",  
      292                 "html_export_singlePage_sepLineCount", 10)  
      293          
      294         if sepLineCount < 0:  
      295             sepLineCount = 10  
    286 296         if len(self.wordList) == 1:  
    287 297             self.exportType = u"html_multi"  
     
    298 308         fp = utf8Writer(realfp, "replace")  
    299 309         fp.write(self.getFileHeaderMultiPage(self.mainControl.wikiName))  
    300            
      310  
    300 310         tocTitle = self.addOpt[2]  
    301 311  
     
    311 321                     (tocTitle, # = "Table of Contents"  
    312 322                     self.getContentTreeBody(flatTree, linkAsFragments=True),  
    313                       u'<br />\n'*10))  
      323                     u'<br />\n' * sepLineCount))  
    313 323  
    314 324         elif self.addOpt[1] == 2:  
     
    319 329                     (tocTitle, # = "Table of Contents"  
    320 330                     self.getContentListBody(linkAsFragments=True),  
    321                       u'<br />\n'*10))  
      331                     u'<br />\n' * sepLineCount))  
    321 331                      
    322 332         links = {}  
    323   #         notExport = sets.Set() # Cache to store all rejected words  
    324   #         wordSet = sets.Set(self.wordList)  
    325   #  
    326   #         def addWord(word):  
    327   #             if word in links:  
    328   #                 return  
    329   #             if word in notExport:  
    330   #                 return  
    331   #                   
    332   #             unAlias = self.wikiData.getAliasesWikiWord(word)  
    333   #             if unAlias not in wordSet:  
    334   #                 notExport.add(word)  
    335   #                 return  
    336   #  
    337   #             wikiPage = self.wikiDataManager.getWikiPage(word)  
    338   #             if not self.shouldExport(word, wikiPage):  
    339   #                 notExport.add(word)  
    340   #                 return  
    341   #               
    342   #             links[word] = u"#%s" % _escapeAnchor(unAlias)  
    343 333  
    344 334         # First build links dictionary for all included words and their aliases  
     
    363 353                 content = wikiPage.getLiveText()  
    364 354                 formatDetails = wikiPage.getFormatDetails()  
    365   #                 links = {}  # TODO Why links to all (even not exported) children?  
    366   #                 for relation in wikiPage.getChildRelationships(  
    367   #                         existingonly=True, selfreference=False):  
    368   #                     if not self.shouldExport(relation):  
    369   #                         continue  
    370   #                     # get aliases too  
    371   #                     relUnAlias = self.wikiData.getAliasesWikiWord(relation)  
    372   #                     # TODO Use self.convertFilename here?  
    373   #                     links[relation] = u"#%s" % _escapeAnchor(relUnAlias)  
    374 355                      
    375 356                 self.wordAnchor = _escapeAnchor(word)  
     
    382 363                         (self.wordAnchor, word,  
    383 364                         self.getParentLinks(wikiPage, False), formattedContent,  
    384                           u'<br />\n'*10))  
      365                         u'<br />\n' * sepLineCount))  
    384 365             except Exception, e:  
    385 366                 traceback.print_exc()  
     
    843 824         """  
    844 825         return len(self.statestack) > 1  
      826          
      827          
      828     def isHtmlSizeValue(sizeStr):  
      829         """  
      830         Test unistring sizestr if it is a valid HTML size info and returns  
      831         True or False  
      832         """  
      833         sizeStr = sizeStr.strip()  
      834         if len(sizeStr) == 0:  
      835             return False  
      836  
      837         if sizeStr[-1] == "%":  
      838             sizeStr = sizeStr[:-1]  
      839  
      840         try:  
      841             val = int(sizeStr)  
      842             return val >= 0  
      843         except ValueError:  
      844             return False  
      845  
      846     isHtmlSizeValue = staticmethod(isHtmlSizeValue)  
    845 847  
    846 848  
     
    1257 1259                 if title is not None:  
    1258 1260                     self.outAppend(u'<span class="wiki-link"><a href="%s" title="%s">' %  
    1259                               (escapeHtml(link), escapeHtml(title)))  
      1261                             (link, escapeHtmlNoBreaks(title)))  
    1259 1261                 else:  
    1260 1262                     self.outAppend(u'<span class="wiki-link"><a href="%s">' %  
    1261                               escapeHtml(link))  
      1263                             link)  
    1261 1263  
    1262 1264                 if astNode.titleTokens is not None:  
     
    1640 1642                             try:  
    1641 1643                                 width, height = sizeInfo.split(u"x")  
    1642                                   width = int(width)  
    1643                                   height = int(height)  
    1644                                   if width >= 0 and height >= 0:  
    1645                                       sizeInTag = ' width="%i" height="%i"' % \  
      1644                                 if self.isHtmlSizeValue(width) and \  
      1645                                         self.isHtmlSizeValue(height):  
      1646                                     sizeInTag = ' width="%s" height="%s"' % \  
    1646 1647                                             (width, height)  
    1647 1648                             except:  
     
    1674 1675                             link = wx.FileSystem.FileNameToURL(p)  
    1675 1676                         self.outAppend(u'<img src="%s" alt="" border="0"%s%s />' %  
    1676                                   (escapeHtml(link), sizeInTag, alignInTag))  
      1677                                 (link, sizeInTag, alignInTag))  
    1676 1677                     else:  
    1677 1678 #                         self.outAppend(u'<a href="%s">%s</a>' %  
  • branches/mbutscher/work/lib/pwiki/wxHelper.py

    r127 r129  
    597 597  
    598 598         return result  
      599      
      600     def GetFirstSelected(self):  
      601         return self.GetNextItem(-1, state=wx.LIST_STATE_SELECTED)  
    599 602  
    600 603  
  • branches/mbutscher/work/lib/pwiki/WikiHtmlViewIE.py

    <
    r127 r129  
    20 20 from MiscEvent import KeyFunctionSink  
    21 21  
    22   from StringOps import uniToGui, utf8Enc, utf8Dec  
      22 from StringOps import uniToGui, utf8Enc, utf8Dec, urlFromPathname, urlQuote  
    22 22  
    23 23 from TempFileSet import TempFileSet  
     
    37