Changeset 12

Show
Ignore:
Timestamp:
09/23/07 07:04:02 (1 year ago)
Author:
baptiste
Message:

Spaces cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/baptiste/fontypython/cli.py

    r11 r12  
    6565#### 
    6666## Let's handle those options that DO NOT require args 
    67 ## List -  Quick and dirty.  
     67## List -  Quick and dirty. 
    6868if options.list: 
    6969    poglist = iPC.getPogNames() 
     
    9393if options.min: fpsys.config.max = False 
    9494if options.max: fpsys.config.max = True 
    95      
     95 
    9696#### 
    9797## Size 
     
    9999if options.points > 0: 
    100100    fpsys.config.points = int(options.points) 
    101      
     101 
    102102#### 
    103103## View 
     
    113113if options.text: 
    114114    fpsys.config.text = options.text 
    115     fpsys.config.Save()         
     115    fpsys.config.Save()       
    116116    print _("Your text has been set to \"%s\"") % options.text 
    117117    print _("Tip: Did you use quotes to surround your text?") 
    118118    print _("Start FontyPython again to see the result.") 
    119119    sys.exit() 
    120      
     120 
    121121#### 
    122122## Let's just make sure the user has a .fonts folder 
     
    136136            ## pog.purge() Raises 
    137137            ##          PogEmpty 
    138             ##          PogInstalled             
     138            ##          PogInstalled 
    139139            pog.purge() 
    140140        except(fontybugs.PogEmpty, fontybugs.PogInstalled), e: 
     
    144144    fpsys.config.Save() 
    145145    sys.exit(strings.done) 
    146      
     146 
    147147#### 
    148148## Report stuff to console. 
     
    150150    print message 
    151151 
    152 ####     
     152####   
    153153## Install: 
    154154if options.install: 
     
    164164            ##          PogEmpty 
    165165            ##          PogAllFontsFailedToInstall 
    166             ##          PogSomeFontsDidNotInstall             
     166            ##          PogSomeFontsDidNotInstall           
    167167            print _("Installing %s") % pogtoinstall 
    168168            pog.install() # will use progressCallBack to print each font name. 
    169         except (fontybugs.PogEmpty,  
     169        except (fontybugs.PogEmpty, 
    170170                        fontybugs.PogAllFontsFailedToInstall, 
    171171                        fontybugs.PogSomeFontsDidNotInstall, 
     
    176176    fpsys.config.Save() 
    177177    sys.exit(strings.done) 
    178      
     178 
    179179#### 
    180180## uninstall 
     
    191191            ##          PogEmpty 
    192192            ##          PogLinksRemain 
    193             ##          PogNotInstalled             
     193            ##          PogNotInstalled           
    194194            print _("Removing %s") % pogtouninstall 
    195195            pog.uninstall() 
     
    202202    fpsys.config.Save() 
    203203    sys.exit(strings.done) 
    204              
     204 
    205205#### 
    206206## If there are > 2 args then there is chaos: 
     
    208208    ## The user may have chosen a pogname with spaces and no quotes 
    209209    print _("""Please check your arguments, there seem to be too many. 
    210 (Remember: it's one pound for a five-minute argument, but only  
     210(Remember: it's one pound for a five-minute argument, but only 
    211211eight pounds for a course of ten.) 
    212      
     212 
    213213NB: If you wanted to use spaces in a pogname or folder then 
    214214please put quotes around them.""") 
    215     sys.exit()  
    216      
    217      
     215    sys.exit() 
     216 
    218217#### 
    219218## Handle Cases : 
     
    221220B = None 
    222221 
    223 fakearg = False  
     222fakearg = False 
    224223if not args: 
    225224    args = [] 
     
    232231A = args [0] 
    233232if len(args) == 2: B = args [1] 
    234      
     233 
    235234## Let's ensure that, should A be a pog, that it exists, BUT only if it was not a fakearg: 
    236235if not fpsys.isFolder(A) and not fpsys.isPog(A) and not fakearg: 
     
    241240if B and fpsys.isFolder(B): 
    242241    sys.exit(_("You cannot use a folder as the target argument. Try --help")) 
    243      
     242 
    244243## Let's ensure that B exists, else we must make it. 
    245244if B and not fpsys.isPog(B): 
     
    252251 
    253252## Build the fpsys structure 
    254 ## Calls to validateXYZ are vital. They are where the View or Target Objects get  
     253## Calls to validateXYZ are vital. They are where the View or Target Objects get 
    255254## generated - i.e. where all their fontItems are built-up. 
    256255## One arg: 
    257256if A and not B: 
    258     if fpsys.isFolder(A):  
     257    if fpsys.isFolder(A): 
    259258        try: 
    260259            fpsys.validateViewFolder(A) 
    261260        except fontybugs.FolderHasNoFonts, e: 
    262261            sys.exit(str(e)) 
    263     if fpsys.isPog(A):  
     262    if fpsys.isPog(A): 
    264263        try: 
    265264            fpsys.validateViewPog(A) 
     
    269268    ## we must make an official "targetobject" set to None 
    270269    fpsys.SetTargetPogToNone() 
    271      
     270 
    272271## Two args: 
    273272if A and B: 
    274     if fpsys.isFolder(A)and fpsys.isPog(B):  
     273    if fpsys.isFolder(A)and fpsys.isPog(B): 
    275274        ## "FP" 
    276275        try: 
     
    283282             sys.exit(str(e)) 
    284283        if installed: sys.exit(_("The target pog (%s) is currently installed,\nyou can't use it as a target." % B)) 
    285          
     284 
    286285    if fpsys.isPog(A)and fpsys.isPog(B): 
    287286        ## "PP" 
     
    293292            sys.exit(str(e)) 
    294293        if empty: sys.exit(_("This pog is empty")) 
    295   
     294 
    296295        try: 
    297296            installed = fpsys.validateTargetPog(B) 
  • branches/baptiste/fontypython/folder.py

    r11 r12  
    4848                #print "f is ", f 
    4949                try: 
    50                     fi = FontItem(os.path.join(self.path, f), False)  
     50                    fi = FontItem(os.path.join(self.path, f), False) 
    5151                except UnicodeDecodeError, e: 
    5252                    sys.exit(_("The file %s has caused a unicode error.\nPlease rename it, removing any strange characters, and try again.") % f) 
    53                 self.append(fi)  
     53                self.append(fi) 
    5454        if len(self) == 0: 
    5555            raise fontybugs.FolderHasNoFonts(self.path) 
    56              
     56 
    5757    def label(self): 
    5858        return str(self.path) 
  • branches/baptiste/fontypython/fpsys.py

    r11 r12  
    3939## other modules - so they are global to everything. 
    4040 
    41  
    4241## Ensure we have a .fontypython folder and a .fonts folder. 
    4342iPC = pathcontrol.PathControl() #Make an instance - hence the small 'i' 
     
    4948        if os.path.islink(root): 
    5049            root = os.path.realpath(root) 
    51         return os.path.dirname(os.path.abspath(root))  
     50        return os.path.dirname(os.path.abspath(root)) 
    5251    except: 
    5352        print _("I'm sorry, but something is wrong.") 
    5453        print _("There is no __file__ variable. Please contact the author.") 
    55         sys.exit()  
     54        sys.exit() 
    5655 
    5756#### 
     
    6160    return False 
    6261#### 
    63 ##   
     62##   
    6463def isPog(thing): 
    6564    if thing in iPC.getPogNames(): return True 
     
    8887        self.samepogs = False 
    8988        self.numticks = 0 
    90          
     89 
    9190state = FPState() #The only instance of the state object -- app-wide 
    9291 
     
    103102    ## Default assumptions in case of raised error. 
    104103    state.viewobject = EmptyView() 
    105     state.viewpattern = "E"  
     104    state.viewpattern = "E" 
    106105    ifolder = Folder(foldername) #raises : fontybugs.FolderHasNoFonts : BENIGN ERROR. 
    107106    ## Only continues if there is no problem. 
     
    120119        ipog = EmptyView() 
    121120    else: 
    122         ipog = Pog(newpog_name)  
     121        ipog = Pog(newpog_name) 
    123122    ## Test TARGETPOG to see if this is the same pogname 
    124123    ## The not None test is for first run - there is no targetobject yet just after cli.py calls us, so we 
     
    150149def validateTargetPog(newpog_name): 
    151150    if state.targetobject: del state.targetobject 
    152     ipog = Pog(newpog_name)  
     151    ipog = Pog(newpog_name) 
    153152    ## Must gen the Pog to get a count of items: 
    154153    ipog.genList() # Raises fontybugs.PogInvalid error THIS ENDS THE APP. 
     
    157156        ## The pog clicked in the TARGET is the same as what's ALREADY selected in the VIEW 
    158157        state.samepogs = True 
    159     else:  
     158    else: 
    160159        state.samepogs = False 
    161160    quickinstalledflag = False 
    162161    if ipog.isInstalled(): quickinstalledflag  = True 
    163     state.targetpattern = "P"  
     162    state.targetpattern = "P" 
    164163    state.targetobject = ipog 
    165164    markInactive() 
    166165    flushTicks() 
    167166    return quickinstalledflag 
    168      
     167    
    169168## Mark each font item as inactive, as needs be. 
    170169## Also clears the ticks. 
    171170def markInactive(): 
    172171    if state.viewobject: state.viewobject.clearInactiveflags() 
    173          
     172        
    174173    if state.viewobject and state.targetobject: 
    175174        ## What's in TARGET must be inactive in VIEW 
  • branches/baptiste/fontypython/wxgui.py

    r11 r12  
    6060    def __init__(self,parent, pos ,fitem) : 
    6161        self.name = fitem.name 
    62          
     62 
    6363        self.fitem = fitem 
    6464        self.parent = parent 
    65          
     65 
    6666        ## I prevent font's own height due to mad ttfs. 
    6767        ## I based this on my preference. Some ttfs had these crazy heights 
    6868        ## and would shoot off the page. So, I nixed that. 
    6969        self.height = fpsys.config.points * 1.55 
    70          
     70 
    7171        self.bitmap, self.goodfont = self.__wxTtfBitmap(self.fitem.paf, fpsys.config.points, " " + fpsys.config.text + " ")  
    7272        self.whitebrush = wx.Brush('WHITE',wx.SOLID)  
    73          
     73 
    7474        sz = (self.bitmap.GetWidth() , self.height)  
    7575        self.gsb = wx.lib.statbmp.GenStaticBitmap.__init__(self,parent, -1, self.bitmap, pos, sz) 
    76          
     76 
    7777        self.width = self.bitmap.GetWidth()  
    78          
     78 
    7979        self.Bind(wx.EVT_LEFT_UP,self.__onClick)  
    8080        self.Bind(wx.EVT_PAINT,  self.__onPaint)  
    81          
     81 
    8282    def __onPaint(self, event) : 
    8383        dc = wx.PaintDC(self)  
     
    153153            if not self.fitem.ticked: fpsys.state.numticks -= 1 
    154154            ps.pub(toggle_main_button) 
    155              
     155 
    156156    def __wxTtfBitmap(self, paf, points, text) : 
    157157        """Make a font and draw it using PIL. Then convert it to a wx bitmap. 
     
    206206        self.fitmaps = [] 
    207207        self.parent = parent 
    208          
     208 
    209209    def DrawFitmaps(self, viewobject) : 
    210210        """Draw X number of fitmaps down the control""" 
     
    214214 
    215215        self.fitmaps = [] 
    216          
     216 
    217217        #### 
    218218        ## It's NB to notice that the fitems being put into self.fitmaps are 
     
    222222        ## you can rely on the the fitem within viewobject having a ticked True/False 
    223223        ## attribute outside of this class. 
    224          
     224 
    225225        i = 0 
    226226        h = 0 
     
    254254    def __init__(self, parent): 
    255255        wx.Panel.__init__(self, parent, id = -1) 
    256          
     256 
    257257        self.pageindex = 1 # I start here 
    258258        self.total_number_of_pages = 0 
    259          
     259 
    260260        self.filter = "" 
    261          
     261 
    262262        self.TICKMAP = None 
    263263        self.TICK = wx.Bitmap(fpsys.mythingsdir + "tick.png", type=wx.BITMAP_TYPE_PNG) 
    264264        self.CROSS = wx.Bitmap(fpsys.mythingsdir + "cross.png", type=wx.BITMAP_TYPE_PNG) 
    265          
     265 
    266266        ## Main Label on top 
    267267        sizerMainLabel = wx.BoxSizer(wx.HORIZONTAL)  
     
    269269        self.textMainInfo.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD)) 
    270270        sizerMainLabel.Add(self.textMainInfo,1,wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)  
    271          
     271 
    272272        ## Page choice and Filter controls 
    273273        sizerOtherControls = wx.BoxSizer(wx.HORIZONTAL) 
     
    278278        self.choicePage = wx.Choice(self, -1, choices = [_("busy")])  
    279279        self.choicePage.Bind(wx.EVT_CHOICE, self.__onPagechoiceClick) #Bind choice event 
    280          
     280 
    281281        sizerOtherControls.Add(self.textFilter, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) 
    282282        sizerOtherControls.Add(self.inputFilter, 1, wx.ALIGN_LEFT | wx.EXPAND) 
    283283        sizerOtherControls.Add(( 4,-1), 0, wx.EXPAND) 
    284284        sizerOtherControls.Add(self.choicePage, 0 ,wx.EXPAND | wx.ALIGN_RIGHT)  #Added it to the sizer 
    285          
     285 
    286286        ## The FONT panell: 
    287         self.panelFontView = FontView(self)  
    288          
    289         buttonsSizer = wx.BoxSizer(wx.HORIZONTAL)  
    290         self.buttPrev = wx.Button(self, wx.ID_BACKWARD)  
    291  
    292         self.buttMain = wx.Button(self, label=_("loading"), id = 3)  
    293         self.buttNext = wx.Button(self, wx.ID_FORWARD)  
     287        self.panelFontView = FontView(self) 
     288 
     289        buttonsSizer = wx.BoxSizer(wx.HORIZONTAL) 
     290        self.buttPrev = wx.Button(self, wx.ID_BACKWARD) 
     291 
     292        self.buttMain = wx.Button(self, label=_("loading"), id = 3) 
     293        self.buttNext = wx.Button(self, wx.ID_FORWARD) 
    294294        self.buttPrev.Enable(False)  #Starts out disabled 
    295          
    296         buttonsSizer.Add(self.buttPrev,0,wx.EXPAND)  
    297         buttonsSizer.Add((10,1) ,0,wx.EXPAND)  
    298         buttonsSizer.Add(self.buttMain,1,wx.EXPAND)  
    299         buttonsSizer.Add((10,1) ,0,wx.EXPAND)  
    300         buttonsSizer.Add(self.buttNext,0,wx.EXPAND)  
     295 
     296        buttonsSizer.Add(self.buttPrev,0,wx.EXPAND) 
     297        buttonsSizer.Add((10,1) ,0,wx.EXPAND) 
     298        buttonsSizer.Add(self.buttMain,1,wx.EXPAND) 
     299        buttonsSizer.Add((10,1) ,0,wx.EXPAND) 
     300        buttonsSizer.Add(self.buttNext,0,wx.EXPAND) 
    301301 
    302302        ## Now the sizer to hold all the fontview controls 
     
    306306        self.sizerFontView.Add(sizerOtherControls, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, border = 3) #Choice and Filter 
    307307        self.sizerFontView.Add(buttonsSizer,0,wx.EXPAND)  #The buttons        
    308          
     308 
    309309        self.SetSizer(self.sizerFontView) 
    310          
     310 
    311311        self.buttPrev.Bind(wx.EVT_LEFT_UP,self.__navClick)  
    312312        self.buttNext.Bind(wx.EVT_LEFT_UP,self.__navClick)  
    313313        self.buttMain.Bind(wx.EVT_LEFT_UP,self.__onMainClick)  
    314      
     314 
    315315        ps.sub(toggle_main_button, self.ToggleMainButton)  
    316          
     316 
    317317    ## Catch the ENTER key in the filter text input control 
    318318    def __evtChar(self, e): 
     
    328328            self.buttMain.SetFocus() 
    329329        e.Skip() 
    330          
     330 
    331331    def __drawTheFonts(self): 
    332332        """Figure out what list of fonts to draw, divide them into pages and draw them.""" 
     
    354354            #print "total_num_fonts=", total_num_fonts 
    355355            gross = total_num_fonts / float(num_in_one_page) 
    356              
     356 
    357357            if gross <= 1: 
    358358                ## There are less than num_in_one_page fonts to be viewed at all. 
     
    364364                if remainder > 0: whole_number_of_pages += 1 
    365365                self.total_number_of_pages = whole_number_of_pages 
    366              
    367              
     366 
    368367            start = current_page * num_in_one_page #leaf thru the pages to the one we are on now. 
    369368            fin = start + num_in_one_page 
    370369            if fin > len(filteredList): fin = len(filteredList) #Make sure we don't overshoot. 
    371              
     370 
    372371            sublist = filteredList[start:fin] #Extract a single page of fonts to display 
    373             
     372 
    374373            self.choicePage.Clear() #Empty the choice control, then refill it: 
    375374            [self.choicePage.Append(str(n))  for n in range(1, self.total_number_of_pages +1)]  
     
    382381        else: 
    383382            self.choicePage.Enable(True) 
    384              
     383 
    385384        self.panelFontView.DrawFitmaps(sublist) 
    386385        self.__buttonState() 
    387          
     386 
    388387    ## Main BUTTON click -- the main "do something" button. 
    389388    def __onMainClick(self, e): 
     
    394393        self.panelFontView.Scroll(xPos, yPos) 
    395394          
    396     def __onPagechoiceClick(self,event)
     395    def __onPagechoiceClick(self,event)
    397396        wx.BeginBusyCursor() 
    398397        if self.pageindex != int(event.GetString() ) : #Only redraw if actually onto another page. 
     
    400399            self.__drawTheFonts()  
    401400        wx.EndBusyCursor() 
    402     def __navClick(self,event) : 
     401 
     402    def __navClick(self,event): 
    403403        wx.BeginBusyCursor() 
    404404        if event.GetId()  == wx.ID_FORWARD:  
     
    414414        self.__drawTheFonts()  
    415415        wx.EndBusyCursor() 
    416     def __buttonState(self) : 
     416 
     417    def __buttonState(self): 
    417418        #state of buttons 
    418419        n = True 
     
    424425        self.buttNext.Enable(n)          
    425426        self.buttPrev.Enable(p)    
     427 
    426428    def ToggleMainButton(self, args = None): 
    427429        if fpsys.state.numticks > 0: self.buttMain.Enable(True) 
    428430        else: self.buttMain.Enable(False) 
    429              
     431 
    430432    def MainFontViewUpdate(self): 
    431433        """Vital routine - the heart if the app.  
    432434        This decides what to do based on what has been selected. 
    433435        It draws the controls and the fonts as appropriate. It also sets flags in fpsys.state.""" 
    434          
     436 
    435437        ## Get shorter vars to use. 
    436438        V= fpsys.state.viewobject 
    437439        T = fpsys.state.targetobject 
    438              
     440 
    439441        Vpatt = fpsys.state.viewpattern # View Pattern 
    440442        Tpatt = fpsys.state.targetpattern # Target pattern 
    441      
     443 
    442444        Patt = Vpatt + Tpatt # Patt = Pattern 
    443          
     445 
    444446        #print "Vpatt", Vpatt 
    445447        #print "Tpatt", Tpatt 
     
    447449        lab = "" 
    448450        status = "" 
    449              
     451 
    450452        if Vpatt == "E": #NOTE : TESTING VPATT, not PATT - ergo: this covers E, EN, EP 
    451453            ## Empty "E" - when the chosen Folder or Pog has NO FONTS IN IT. 
     
    457459            fpsys.state.cantick = False 
    458460            fpsys.state.action = "CLOSE" # We will test this in mainframe::OnMainClick 
    459              
     461 
    460462        elif Patt == "FN": 
    461463            #View a Folder, no target 
     
    519521        else: 
    520522            sys.exit(_("%s and trouble") % Patt) 
    521              
     523 
    522524        self.buttMain.SetLabel(btext) 
    523525        self.textMainInfo.SetLabel(lab) 
     
    526528            ps.pub(print_to_status_bar, status) 
    527529        self.ToggleMainButton() 
    528          
     530 
    529531        fpsys.markInactive() 
    530532        self.__drawTheFonts() 
     
    532534    def ResetToPageOne(self): 
    533535        self.pageindex = 1 # I start here 
    534          
     536 
    535537## Far right-hand side control. Chooses target pogs. Houses control buttons. 
    536538class TargetPogChooser(wx.Panel): 
     
    538540    def __init__(self, parent): 
    539541        wx.Panel.__init__(self, parent, id = -1)     
    540          
     542 
    541543        self.icon = wx.StaticBitmap(self, -1, wx.Bitmap(fpsys.mythingsdir + 'icon_target_16x16.png', wx.BITMAP_TYPE_PNG)) 
    542544        self.textInfo = wx.StaticText(self, -1, _("Target Pogs"), style = wx.ALIGN_LEFT) #CENTER_HORIZONTAL)  
     
    545547            s = fpsys.state.targetobject.name 
    546548        self.pogTargetlist = PogChooser(self, select = s)  
    547          
     549 
    548550        ## Subscriptions: 
    549551        ps.sub(pog_selected, self.OnPogTargetClick) 
    550552        ps.sub(toggle_buttons, self.ToggleButtons) 
    551553        ps.sub(select_no_target_pog, self.SelectNoTargetPog) 
    552          
     554 
    553555        ## The "no pog" button 
    554556        self.idnone = wx.NewId() 
     
    562564        self.iddelete = wx.NewId() 
    563565        self.idpurge = wx.NewId() 
    564          
     566 
    565567        self.buttNew = wx.Button(self, label = _("New Pog"), id = self.idnew )  
    566568        self.buttInstall = wx.Button(self, label = _("Install Pog"), id = self.idinstall )  
     
    568570        self.buttDelete = wx.Button(self, label = _("Delete Pog"), id = self.iddelete)  
    569571        self.buttPurge = wx.Button(self, label = _("Purge Pog"), id = self.idpurge)  
    570          
     572 
    571573        self.sizer = wx.BoxSizer(wx.VERTICAL)          
    572574        self.iconandtext = wx.BoxSizer(wx.HORIZONTAL) 
     
    582584        self.sizer.Add(self.buttPurge, 0, wx.EXPAND) 
    583585        self.SetSizer(self.sizer) 
    584          
     586 
    585587        ## Bind the events: 
    586588        self.buttNoPog.Bind(wx.EVT_LEFT_UP, self.__multiClick) 
     
    590592        self.buttDelete.Bind(wx.EVT_LEFT_UP, self.__multiClick) 
    591593        self.buttPurge.Bind(wx.EVT_LEFT_UP, self.__multiClick) 
    592          
     594 
    593595        self.__toggleButtons() 
    594596    ## Catch all the button clicks on the control. 
     
    622624            dlg.Destroy() 
    623625            return 
    624              
     626 
    625627        ## DELETE 
    626628        if e.GetId() == self.iddelete: 
     
    653655            dlg.Destroy() 
    654656            return  
    655          
     657 
    656658        ## NO POG pressed 
    657659        if e.GetId() == self.idnone: 
     
    693695        if e.GetId() == self.iduninstall: 
    694696            ps.pub(uninstall_pog) 
    695          
     697 
    696698    def OnPogTargetClick(self, args): 
    697699        ## id of the originating instance is sent in args [1] 
     
    713715        ps.pub(update_font_view) 
    714716        self.__toggleButtons() 
    715          
     717 
    716718    def ToggleButtons(self, args): 
    717719        ## Shadow the __toggleButtons func.  
     
    730732        self.buttUninstall.Enable(installed) # UNINSTALL = True if pog is installed. 
    731733        self.buttPurge.Enable(not(installed)) 
    732          
     734 
    733735    def SelectNoTargetPog(self, args): 
    734736        ## Shadow 
     
    747749        self.indexselected = 0 
    748750        self.lastindexselected = -1 
    749          
     751 
    750752        il = wx.ImageList(16,16,True)  
    751753        png = wx.Bitmap(fpsys.mythingsdir + "/pog16x16.png",wx.BITMAP_TYPE_PNG)  
     
    753755        png = wx.Bitmap(fpsys.mythingsdir + "/pog16x16.installed.png",wx.BITMAP_TYPE_PNG)  
    754756        il.Add(png) 
    755          
     757 
    756758        wx.ListCtrl.__init__(self,parent,-1, style=wx.LC_LIST | wx.LC_AUTOARRANGE | wx.LC_SORT_ASCENDING)  
    757759        self.AssignImageList(il, wx.IMAGE_LIST_SMALL)  
    758760 
    759761        self.__PC = pathcontrol.PathControl() 
    760          
     762 
    761763        self.__fillPogList()  
    762          
     764 
    763765        if select: 
    764766            i = self.FindItem(-1, select) 
     
    769771        self.ClearBackground()  
    770772        self.items = None 
    771          
     773 
    772774        ## These two work together: 
    773775        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.__onSelect)  
    774          
     776 
    775777        self.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) 
    776          
     778 
    777779        ## A subscribe line here, will register TWICE since this PogChooser object is instanced 
    778780        ## twice by the app... 
    779781        ps.sub(change_pog_icon, self.ChangeIcon) 
    780          
     782 
    781783    def __onSelect(self, e): 
    782784        wx.BeginBusyCursor() 
     
    796798    def __del__(self) : 
    797799        del self.items 
    798          
     800 
    799801    ## This is among the very FIRST things we do. 
    800802    ## Fill the list with pogs. 
     
    818820            except: 
    819821                sys.exit(sys.exc_info()[0]) 
    820                  
     822       
    821823    def AddItem(self, pogname): 
    822824        li = wx.ListItem() 
     
    824826        li.SetText(pogname) 
    825827        self.InsertItem(li) 
    826          
     828 
    827829    def RemoveItem(self, pogname): 
    828830        i = self.FindItem(-1, pogname) 
     
    832834        self.Select(self.indexselected, False) 
    833835        self.lastindexselected = -1 
    834      
     836 
    835837    def ChangeIcon(self, args): 
    836838        T = fpsys.state.targetobject 
     
    840842        else: n = 0 
    841843        self.SetItemImage(index, n) ## Found in wxWidgets documentation! 
    842          
    843      
     844 
    844845    ## Need to reset the lastindexselected so that a click on the  
    845846    ## same item as last time will register. This is used in the Notebook 
     
    854855        wx.SplitterWindow.__init__(self, parent, -1, style = wx.SP_LIVE_UPDATE | wx.SP_3D)  
    855856 
    856  
    857857## A short class as I started to abstract the Directory Control.  
    858858## Eventually I want a fully standalone version. 
    859 class DirControl(wx.GenericDirCtrl)
     859class DirControl(wx.GenericDirCtrl)
    860860    def __init__(self, parent): 
    861         if fpsys.state.viewpattern == "F": startdir = fpsys.state.viewobject.path 
     861        if fpsys.state.viewpattern == "F": 
     862            startdir = fpsys.state.viewobject.path 
    862863        else:  
    863864            ##Let's get it from the config object 
     
    867868            else: 
    868869                startdir = os.environ['HOME'] 
    869         wx.GenericDirCtrl.__init__(self, parent, -1, dir = startdir, style=wx.DIRCTRL_DIR_ONLY)  #size=(200,225) 
    870         self.tree = self.GetTreeCtrl()  
     870        wx.GenericDirCtrl.__init__(self, parent, -1, dir=startdir, style=wx.DIRCTRL_DIR_ONLY)  #size=(200,225) 
     871        self.tree = self.GetTreeCtrl() 
    871872        self.tree.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) 
    872873 
     
    874875## Has two tabs - Folders and Pogs 
    875876## THIS IS THE VIEW or SOURCE of fonts. 
    876 class NoteBook(wx.Notebook)
     877class NoteBook(wx.Notebook)
    877878    def __init__(self, parent): 
    878879        wx.Notebook.__init__(self, parent) 
    879880        self.imlist = wx.ImageList(16, 16) 
    880          
     881 
    881882        pan1 = wx.Panel(self) 
    882         self.dircontrol = DirControl(pan1)  
    883          
     883        self.dircontrol = DirControl(pan1) 
     884 
    884885        box = wx.BoxSizer(wx.HORIZONTAL)  
    885886        box.Add(self.dircontrol,1, wx.EXPAND)  
     
    888889 
    889890        self.pogindexselected = 0 
    890          
    891         pan2 = wx.Panel(self)  
    892          
     891 
     892        pan2 = wx.Panel(self) 
     893 
    893894        page = 0 
    894895        s = None 
    895         if fpsys.state.viewpattern  == "P":  
     896        if fpsys.state.viewpattern  == "P": 
    896897            s = fpsys.state.viewobject.name 
    897898            if s == "EMPTY": s= None #Very first run, the view will be an EMPTY object. 
     
    901902        ps.sub(pog_selected, self.OnViewPogClick) 
    902903        ps.sub(select_no_view_pog, self.SelectNoView) 
    903          
     904 
    904905        self.tree = self.dircontrol.GetTreeCtrl() 
    905906        #self.tree.Bind(wx.EVT_LEFT_DCLICK, self.__onDirCtrlDClick) #Old system - double click. 
    906907        #self.tree.Bind(wx.EVT_LIST_ITEM_SELECTED, self.__onDirCtrlDClick) #Did not fire. 
    907908        self.tree.Bind(wx.EVT_LEFT_UP, self.__onDirCtrlClick) 
    908          
     909 
    909910        box2 = wx.BoxSizer(wx.HORIZONTAL)  
    910911        box2.Add(self.listctrl,1,wx.EXPAND)  
    911912        pan2.SetSizer(box2)  
    912913        box2.Layout()  
    913          
     914 
    914915        self.AddPage(pan1, _("Folders"))  
    915916        self.AddPage(pan2, _("Pogs")) 
    916          
     917 
    917918        source_pog_icon = self.imlist.Add(wx.Bitmap(fpsys.mythingsdir + "/icon_source_pog_16x16.png",wx.BITMAP_TYPE_PNG)) 
    918919 
     
    921922        self.SetPageImage(1, source_pog_icon) 
    922923        self.SetPageImage(0, target_pog_icon) 
    923          
     924 
    924925        self.SetSelection(page) 
    925      
     926 
    926927        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.__onPageChanged) # Bind page changed event 
    927          
     928 
    928929    def __onPageChanged(self, e): 
    929930        self.listctrl.ClearLastIndex() 
    930931        e.Skip() 
    931          
     932 
    932933    def __onDirCtrlClick(self, e): 
    933934        wx.BeginBusyCursor() #Thanks to Suzuki Alex on the wxpython list! 
     
    940941        ps.pub(update_font_view) 
    941942        wx.EndBusyCursor() 
    942          
     943 
    943944    def OnViewPogClick(self, args): 
    944945        ## id of the originating instance is sent in args[1] 
     
    964965    def RemoveItem(self, pogname): 
    965966        self.listctrl.RemoveItem(pogname) 
    966          
     967 
    967968    def SelectNoView(self, args): 
    968969        ## Purpose: To select no viewobject and clear view pog list selections 
     
    972973        fpsys.SetViewPogToEmpty() 
    973974        wx.EndBusyCursor() 
    974          
     975 
    975976## Status bar 
    976977class StatusBar(wx.StatusBar): 
     
    981982    def Report(self, msg): 
    982983        self.SetStatusText(msg, 0) 
    983          
     984 
    984985## The main brain of the app. 
    985986class MainFrame(wx.Frame) : 
     
    988989        wx.Frame.__init__(self,parent,-1,title,fpsys.config.pos,fpsys.config.size)  
    989990        self.SetSizeHintsSz((300,400) )  #After hours of hell, this is all that seems to work. 
    990          
     991 
    991992        ## Try to show an icon 
    992993        try: 
     
    10001001 
    10011002        max = fpsys.config.max # Do we draw min or max interface? 
    1002          
     1003 
    10031004        PARENT = self 
    1004          
     1005 
    10051006        ## STATUS BAR 
    10061007        self.sb = StatusBar(self) 
    10071008        self.SetStatusBar(self.sb) 
    1008          
     1009 
    10091010        if max: 
    10101011            ## Prepare the menu bar 
    10111012            menuBar = wx.MenuBar() 
    1012      
     1013 
    10131014            ## 1st menu from left 
    10141015            menu1 = wx.Menu() 
     
    10181019            ## Add menu to the menu bar 
    10191020            menuBar.Append(menu1, _("&File")) 
    1020      
     1021 
    10211022            ## 2nd menu from left 
    10221023            menu2 = wx.Menu()  
     
    10251026            ## Append 2nd menu 
    10261027            menuBar.Append(menu2, _("&Help")) 
    1027      
     1028 
    10281029            ## Tell the frame the news 
    10291030            self.SetMenuBar(menuBar) 
    1030      
     1031 
    10311032            ## Setup the ESC key trap 
    10321033            accel = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, exit.GetId())]) 
    10331034            self.SetAcceleratorTable(accel) 
    1034              
     1035 
    10351036            self.Bind(wx.EVT_MENU, self.__onHandleESC, exit) 
    10361037            self.Bind(wx.EVT_MENU, self.__menuSettings, id = 101) 
     
    10441045            self.SetAcceleratorTable(self.accel) 
    10451046            self.Bind(wx.EVT_MENU, self.__onHandleESC, id=ID_ESC) 
    1046              
     1047 
    10471048        ## Create a splitter  
    10481049        if max:  
    10491050            self.splitter = Splitter(self)  
    1050          
     1051 
    10511052            ## The notebook : has a bunch of callbacks it needs to make. 
    10521053            self.panelNotebook = wx.Panel(self.splitter)  
    10531054            self.nb = NoteBook(self.panelNotebook) 
    1054              
     1055 
    10551056            self.sizerNotebook = wx.BoxSizer(wx.HORIZONTAL)  
    10561057            self.sizerNotebook.Add(self.nb,1,wx.EXPAND)  
    1057              
     1058 
    10581059            self.panelNotebook.SetSizer(self.sizerNotebook)  
    10591060            self.sizerNotebook.Layout()  
    1060              
     1061 
    10611062            PARENT = self.splitter 
    1062          
     1063 
    10631064        self.panelMain = wx.Panel(PARENT ) 
    1064          
     1065 
    10651066        ## Font View Panel Control: 
    10661067        self.panelFontView = FontViewPanel(self.panelMain) 
    1067          
     1068 
    10681069        self.sizerFontView  = wx.BoxSizer(wx.VERTICAL)  
    10691070        self.sizerFontView.Add(self.panelFontView, 1, wx.EXPAND) 
    1070   
     1071 
    10711072        if max: 
    10721073            ## THE FAR RIGHT HAND SIDE 
     
    10771078            self.sizerRight = wx.BoxSizer(wx.HORIZONTAL)  
    10781079            self.sizerSpace.Add(self.panelTargetPogChooser, 1, wx.EXPAND | wx.LEFT, border = 3) ## couched the panelTargetPogChooser in this to allow space around edges 
    1079              
     1080 
    10801081            self.sizerRight.Add(self.sizerFontView, 1, wx.EXPAND)  
    10811082            self.sizerRight.Add(self.sizerSpace, 0, wx.EXPAND)  
    1082              
     1083 
    10831084            self.panelMain.SetSizer(self.sizerRight)  
    10841085        else: 
    10851086            self.panelMain.SetSizer(self.sizerFontView) 
    1086              
     1087 
    10871088        self.panelMain.Layout()  
    10881089 
     
    10901091            self.splitter.SetMinimumPaneSize(64)  
    10911092            self.splitter.SplitVertically(self.panelNotebook, self.panelMain ,180)  
    1092      
    1093      
     1093 
    10941094        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) 
    1095          
     1095 
    10961096        ## Now to subscribe to have my various def called from other places: 
    10971097        ps.sub(update_font_view, self.UpdateFontViewPanel) 
     
    11091109        ## call the big one - the big chief, the big cheese: 
    11101110        self.UpdateFontViewPanel() #Go and fill in the font view and surrounding controls 
    1111          
     1111 
    11121112    ## PUBLIC API: 
    11131113    def StatusbarPrint(self, args): 
     
    11201120        """Calls ResetToPageOne in the FontViewPanel""" 
    11211121        self.panelFontView.ResetToPageOne() 
    1122          
     1122 
    11231123    def MessageBox(self, args): 
    11241124        dlg = wx.MessageDialog(self, args[0] , _("Warning"), wx.OK | wx.ICON_INFORMATION) 
     
    11321132        self.ErrorBox(args) #Pass it along to be displayed 
    11331133        self.__endApp() 
    1134          
     1134 
    11351135    def UpdateFontViewPanel(self, args = None): 
    11361136        self.panelFontView.MainFontViewUpdate() 
    11371137        self.Refresh() 
    1138      
     1138 
    11391139    def InstallPog(self, args): 
    11401140        ## pog.install() Raises: 
     
    11781178        self.UpdateFontViewPanel() 
    11791179 
    1180              
    11811180    def OnMainClick(self, args) : 
    11821181        """Closes