Changeset 572

Show
Ignore:
Timestamp:
13/11/2008 01:08:26 (2 months ago)
Author:
nextime
Message:

Updated layoutEditor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/main/pythoncard/tags/venus/debian/changelog

    r571 r572  
     1pythoncard (1.1.2.venus-5) stable; urgency=low 
     2 
     3  * Updated layoutEditor. 
     4 
     5 -- Unixmedia S.r.l. (Medianix Devel) <devel@unixmedia.it>  Thu, 13 Nov 2008 01:03:07 +0100 
     6 
    17pythoncard (1.1.2.venus-4) stable; urgency=low 
    28 
  • packages/main/pythoncard/tags/venus/tools/resourceEditor/layoutEditor.py

    r564 r572  
    158158        self.alignToGrid = self.menuBar.getChecked('menuOptionsAlignToGrid') 
    159159        self.showGridLines = self.menuBar.getChecked('menuOptionsShowGridLines') 
     160         
     161        self.showLayoutSizers = self.menuBar.getChecked('menuOptionsShowLayoutWithSizers') 
     162        self.fixedLocations = [] 
    160163 
    161164        path = os.path.join(self.application.applicationDirectory, 'templates', \ 
     
    240243        startTime = time.time() 
    241244        desc = multiresourceOutput.resourceAttributes(self) 
    242         #agtrint "converted ", len(desc), time.time()-startTime 
    243245        if len(self.undoList) > 0 and desc == self.undoList[-1]: 
    244246            #agtrint "same" 
    245247            pass 
    246248        else: 
    247 ##            print "saved to list\n", desc 
    248249            self.undoList.append(desc) 
    249250        self.redoList = [] 
     
    252253        #rint len(self.undoList), len(self.redoList), len(self.undoList[0]), len(self.undoList[-1]) 
    253254 
     255        if self.showLayoutSizers: 
     256            self.rsrc = resource.Resource(eval(desc, globals())) 
     257            if self.editingDialog:  
     258                bg = self.rsrc 
     259            else: 
     260                bg = self.rsrc.application.backgrounds[0] 
     261            if hasattr(bg, 'sizers') and not self._sizerTree: 
     262                model.layoutEachSizer(self, bg.sizers, None, None) 
     263        else: 
     264            self.panel.SetSizer(None) 
     265            self._sizerTree = None 
     266 
    254267             
    255268    def on_menuEditUndo_select(self, event): 
    256         #rint 'start undo', len(self.undoList), len(self.redoList) 
    257269        if len(self.undoList) == 1: 
    258270            msg = "Nothing to undo." 
     
    262274        startTime = time.time() 
    263275        desc = multiresourceOutput.resourceAttributes(self) 
    264         #agtrint "converted ", len(desc), time.time()-startTime 
    265276        self.redoList.append(desc) 
    266277        self.menuBar.setEnabled('menuEditRedo', True) 
     
    268279        if desc == self.undoList[-1]: 
    269280            del self.undoList[-1] 
    270             #rint "same (i.e. OK?)", len(self.undoList) 
    271281            if len(self.undoList) == 0: return 
    272282        else: 
    273283            print "different !!!!!!!!!!!!1" 
    274284             
    275         #agtrint "undoing", len(self.undoList) 
    276285        self.resetAndClearWidgets() 
    277286        desc = self.undoList[-1] 
    278 ##        del self.undoList[-1] 
    279         #rint "undoing back to\n", len(desc), len(self.undoList) 
    280287        self.rsrc = resource.Resource(eval(desc, globals())) 
    281288        self.useNewResource() 
    282289        if len(self.undoList) <= 1: 
    283290            self.menuBar.setEnabled('menuEditUndo', False) 
    284         #rint len(self.undoList), len(self.redoList) 
    285291         
    286292    def on_menuEditRedo_select(self, event): 
    287         #rint 'start redo', len(self.undoList), len(self.redoList) 
    288293        if len(self.redoList) == 0: 
    289294            msg = "Nothing to redo." 
     
    293298        startTime = time.time() 
    294299        desc = multiresourceOutput.resourceAttributes(self) 
    295         #agtrint "converted ", len(desc), time.time()-startTime 
    296 ######        self.undoList.append(desc) 
    297300        self.menuBar.setEnabled('menuEditUndo', True) 
    298301         
    299 ####        if desc == self.redoList[-1]: 
    300 ####            #agtrint "same" 
    301 ####            del self.redoList[-1] 
    302 ####            if len(self.redoList) == 0: return 
    303              
    304         #agtrint "redoing", len(self.redoList) 
    305302        self.resetAndClearWidgets() 
    306303        desc = self.redoList[-1] 
    307304        self.undoList.append(desc) 
    308305        del self.redoList[-1] 
    309         #agtrint desc 
    310306        self.rsrc = resource.Resource(eval(desc, globals())) 
    311307        self.useNewResource() 
    312308        if len(self.redoList) == 0: 
    313309            self.menuBar.setEnabled('menuEditRedo', False) 
    314         #rint len(self.undoList), len(self.redoList) 
    315310 
    316311    def isSizingHandle(self, name): 
     
    840835            self.dc.DrawRectanglePointSize((self.marqueeBase[0], self.marqueeBase[1]),  
    841836                (self.marqueeSize[0], self.marqueeSize[1])) 
     837 
    842838            # use the global mouse position and the initial offset and start 
    843839            # to figure out where to draw a rect in global coordinates 
     
    996992                self.startName = None 
    997993            return 
    998         #print "selct anything within", self.startGlobalPosition, self.marqueeSize 
    999994        res = self.controlInRect(self.startGlobalPosition, self.marqueeSize) 
    1000995        self.marquee = False 
    1001         #print "we found", res 
    1002996        if res == []: return 
    1003997 
     
    20812075        self.panel.Refresh() 
    20822076 
     2077    def on_menuOptionsShowLayoutWithSizers_select(self, event): 
     2078        self.showLayoutSizers = self.menuBar.getChecked('menuOptionsShowLayoutWithSizers') 
     2079        if self.showLayoutSizers: 
     2080            self.fixedLocations = [ ("_", self.position, self.size) ] 
     2081            for cmp in self.components.iterkeys(): 
     2082                name = self.components[cmp].name 
     2083                if name in self.sizingHandleNames: continue 
     2084                self.fixedLocations.append( (name, self.components[cmp].position, self.components[cmp].size) ) 
     2085            self.noteDocumentChanged(True, "switch to layoutsizer") 
     2086        else: 
     2087            for x in self.fixedLocations: 
     2088                if x[0] == "_": 
     2089                    self.position = x[1] 
     2090                    self.size = x[2] 
     2091                else: 
     2092                    self.components[x[0]].position = x[1] 
     2093                    self.components[x[0]].size = x[2] 
     2094            self.noteDocumentChanged(True, "switch from layoutsizer") 
     2095        self.updatePanel(self.rsrc) 
     2096 
    20832097    def getCommandLineArgs(self): 
    20842098        args = ' ' 
  • packages/main/pythoncard/tags/venus/tools/resourceEditor/modules/multiresourceOutput.py

    r564 r572  
    3232    dFont = repr(comp.wUpdate.font) 
    3333    dTextBgC = comp.fldname.backgroundColor.Get() 
    34      
     34 
     35    pos = aWidget.position 
     36    siz = aWidget.size 
     37    for x in background.fixedLocations: 
     38        if x[0] == aWidget.name: 
     39            pos = x[1] 
     40            siz = x[2] 
     41            break 
     42 
    3543    # make sure these primary attributes show up 
    3644    # at the beginning of the listing 
     
    4553 
    4654    dStr += "    'name':'%s', \n" % aWidget.name 
    47     dStr += "    'position':%s, \n" % str(aWidget.position) 
     55    dStr += "    'position':%s, \n" % str(pos) 
     56##    dStr += "    'position':%s, \n" % str(aWidget.position) 
    4857 
    4958    # try and determine default sizes         
    50     width, height = aWidget.size 
     59##    width, height = aWidget.size 
     60    width, height = siz 
    5161    if aWidget.__class__.__name__ in imgWidgets: 
    5262        width, height = aWidget._size 
  • packages/main/pythoncard/trunk/debian/changelog

    r571 r572  
     1pythoncard (1.1.2-4) unstable; urgency=low 
     2 
     3  * updated layoutEditor. 
     4 
     5 -- Unixmedia S.r.l. (Medianix Devel) <devel@unixmedia.it>  Thu, 13 Nov 2008 01:02:18 +0100 
     6 
    17pythoncard (1.1.2-3.1) unstable; urgency=low 
    28 
  • packages/main/pythoncard/trunk/tools/resourceEditor/layoutEditor.py

    r564 r572  
    158158        self.alignToGrid = self.menuBar.getChecked('menuOptionsAlignToGrid') 
    159159        self.showGridLines = self.menuBar.getChecked('menuOptionsShowGridLines') 
     160         
     161        self.showLayoutSizers = self.menuBar.getChecked('menuOptionsShowLayoutWithSizers') 
     162        self.fixedLocations = [] 
    160163 
    161164        path = os.path.join(self.application.applicationDirectory, 'templates', \ 
     
    240243        startTime = time.time() 
    241244        desc = multiresourceOutput.resourceAttributes(self) 
    242         #agtrint "converted ", len(desc), time.time()-startTime 
    243245        if len(self.undoList) > 0 and desc == self.undoList[-1]: 
    244246            #agtrint "same" 
    245247            pass 
    246248        else: 
    247 ##            print "saved to list\n", desc 
    248249            self.undoList.append(desc) 
    249250        self.redoList = [] 
     
    252253        #rint len(self.undoList), len(self.redoList), len(self.undoList[0]), len(self.undoList[-1]) 
    253254 
     255        if self.showLayoutSizers: 
     256            self.rsrc = resource.Resource(eval(desc, globals())) 
     257            if self.editingDialog:  
     258                bg = self.rsrc 
     259            else: 
     260                bg = self.rsrc.application.backgrounds[0] 
     261            if hasattr(bg, 'sizers') and not self._sizerTree: 
     262                model.layoutEachSizer(self, bg.sizers, None, None) 
     263        else: 
     264            self.panel.SetSizer(None) 
     265            self._sizerTree = None 
     266 
    254267             
    255268    def on_menuEditUndo_select(self, event): 
    256         #rint 'start undo', len(self.undoList), len(self.redoList) 
    257269        if len(self.undoList) == 1: 
    258270            msg = "Nothing to undo." 
     
    262274        startTime = time.time() 
    263275        desc = multiresourceOutput.resourceAttributes(self) 
    264         #agtrint "converted ", len(desc), time.time()-startTime 
    265276        self.redoList.append(desc) 
    266277        self.menuBar.setEnabled('menuEditRedo', True) 
     
    268279        if desc == self.undoList[-1]: 
    269280            del self.undoList[-1] 
    270             #rint "same (i.e. OK?)", len(self.undoList) 
    271281            if len(self.undoList) == 0: return 
    272282        else: 
    273283            print "different !!!!!!!!!!!!1" 
    274284             
    275         #agtrint "undoing", len(self.undoList) 
    276285        self.resetAndClearWidgets() 
    277286        desc = self.undoList[-1] 
    278 ##        del self.undoList[-1] 
    279         #rint "undoing back to\n", len(desc), len(self.undoList) 
    280287        self.rsrc = resource.Resource(eval(desc, globals())) 
    281288        self.useNewResource() 
    282289        if len(self.undoList) <= 1: 
    283290            self.menuBar.setEnabled('menuEditUndo', False) 
    284         #rint len(self.undoList), len(self.redoList) 
    285291         
    286292    def on_menuEditRedo_select(self, event): 
    287         #rint 'start redo', len(self.undoList), len(self.redoList) 
    288293        if len(self.redoList) == 0: 
    289294            msg = "Nothing to redo." 
     
    293298        startTime = time.time() 
    294299        desc = multiresourceOutput.resourceAttributes(self) 
    295         #agtrint "converted ", len(desc), time.time()-startTime 
    296 ######        self.undoList.append(desc) 
    297300        self.menuBar.setEnabled('menuEditUndo', True) 
    298301         
    299 ####        if desc == self.redoList[-1]: 
    300 ####            #agtrint "same" 
    301 ####            del self.redoList[-1] 
    302 ####            if len(self.redoList) == 0: return 
    303              
    304         #agtrint "redoing", len(self.redoList) 
    305302        self.resetAndClearWidgets() 
    306303        desc = self.redoList[-1] 
    307304        self.undoList.append(desc) 
    308305        del self.redoList[-1] 
    309         #agtrint desc 
    310306        self.rsrc = resource.Resource(eval(desc, globals())) 
    311307        self.useNewResource() 
    312308        if len(self.redoList) == 0: 
    313309            self.menuBar.setEnabled('menuEditRedo', False) 
    314         #rint len(self.undoList), len(self.redoList) 
    315310 
    316311    def isSizingHandle(self, name): 
     
    840835            self.dc.DrawRectanglePointSize((self.marqueeBase[0], self.marqueeBase[1]),  
    841836                (self.marqueeSize[0], self.marqueeSize[1])) 
     837 
    842838            # use the global mouse position and the initial offset and start 
    843839            # to figure out where to draw a rect in global coordinates 
     
    996992                self.startName = None 
    997993            return 
    998         #print "selct anything within", self.startGlobalPosition, self.marqueeSize 
    999994        res = self.controlInRect(self.startGlobalPosition, self.marqueeSize) 
    1000995        self.marquee = False 
    1001         #print "we found", res 
    1002996        if res == []: return 
    1003997 
     
    20812075        self.panel.Refresh() 
    20822076 
     2077    def on_menuOptionsShowLayoutWithSizers_select(self, event): 
     2078        self.showLayoutSizers = self.menuBar.getChecked('menuOptionsShowLayoutWithSizers') 
     2079        if self.showLayoutSizers: 
     2080            self.fixedLocations = [ ("_", self.position, self.size) ] 
     2081            for cmp in self.components.iterkeys(): 
     2082                name = self.components[cmp].name 
     2083                if name in self.sizingHandleNames: continue 
     2084                self.fixedLocations.append( (name, self.components[cmp].position, self.components[cmp].size) ) 
     2085            self.noteDocumentChanged(True, "switch to layoutsizer") 
     2086        else: 
     2087            for x in self.fixedLocations: 
     2088                if x[0] == "_": 
     2089                    self.position = x[1] 
     2090                    self.size = x[2] 
     2091                else: 
     2092                    self.components[x[0]].position = x[1] 
     2093                    self.components[x[0]].size = x[2] 
     2094            self.noteDocumentChanged(True, "switch from layoutsizer") 
     2095        self.updatePanel(self.rsrc) 
     2096 
    20832097    def getCommandLineArgs(self): 
    20842098        args = ' ' 
  • packages/main/pythoncard/trunk/tools/resourceEditor/modules/multiresourceOutput.py

    r564 r572  
    3232    dFont = repr(comp.wUpdate.font) 
    3333    dTextBgC = comp.fldname.backgroundColor.Get() 
    34      
     34 
     35    pos = aWidget.position 
     36    siz = aWidget.size 
     37    for x in background.fixedLocations: 
     38        if x[0] == aWidget.name: 
     39            pos = x[1] 
     40            siz = x[2] 
     41            break 
     42 
    3543    # make sure these primary attributes show up 
    3644    # at the beginning of the listing 
     
    4553 
    4654    dStr += "    'name':'%s', \n" % aWidget.name 
    47     dStr += "    'position':%s, \n" % str(aWidget.position) 
     55    dStr += "    'position':%s, \n" % str(pos) 
     56##    dStr += "    'position':%s, \n" % str(aWidget.position) 
    4857 
    4958    # try and determine default sizes         
    50     width, height = aWidget.size 
     59##    width, height = aWidget.size 
     60    width, height = siz 
    5161    if aWidget.__class__.__name__ in imgWidgets: 
    5262        width, height = aWidget._size