dabo Commit
Revision 4074
Date: 2008-05-05 14:34:28 -0700 (Mon, 05 May 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4074
Changed:
U branches/ed-ide/Studio.py
Log:
Incremental commit
Diff:
Modified: branches/ed-ide/Studio.py
===================================================================
--- branches/ed-ide/Studio.py 2008-05-05 20:37:43 UTC (rev 4073)
+++ branches/ed-ide/Studio.py 2008-05-05 21:34:28 UTC (rev 4074)
@@ -12,17 +12,78 @@
from components.CxnEditor import CxnEditor
from components.MenuDesigner import MenuDesigner
from components.ReportDesigner import ReportDesigner
-from components.TextEditor import TextEditor
+from components.TextEditor import TextEditorPage
-class StudioForm(dabo.ui.dForm):
+class ProjectTree(dabo.ui.dTreeView):
+ def beforeInit(self):
+ self.controller = None
+
+ def onContextMenu(self, evt):
+ nd = self.getNodeUnderMouse()
+ if not nd:
+ return
+ # Full path is in the ToolTipText
+ pth = nd.ToolTipText
+ if os.path.isfile(pth):
+ self._context = dict(node=nd, filepath=pth)
+ pop = self.createContextMenu(pth)
+ self.showContextMenu(pop)
+
+
+ def createContextMenu(self, pth):
+ pop = dabo.ui.dMenu()
+ pop.append(_("Edit"), OnHit=self.onEditFile)
+ return pop
+
+
+ def onEditFile(self, evt):
+ if not self._context:
+ print "WASSIP with dat?"
+ return
+ nd = self._context["node"]
+ pth = self._context["filepath"]
+ if pth.endswith(".py"):
+ self.controller.editFile(pth)
+
+
+
+class StudioForm(dabo.ui.dSplitForm):
def initProperties(self):
self.Caption = _("Dabo Developer Studio")
+ self.Orientation = "h"
-# def afterInit(self):
-# self.tree = dabo.ui.dTreeView(self.Panel1)
-# self.tree.makeDirTree("/Users/ed/apps/billing", ignored="*pyc",
expand=True)
+ def afterInit(self):
+ dabo.ui.setAfter(self.Splitter, "SashPercent", 30)
+ pnl1 = self.Panel1
+ pnl1.Sizer.Orientation = "v"
+ btn = dabo.ui.dButton(pnl1, Caption="Open Project",
OnHit=self.onOpenProject)
+ pnl1.Sizer.append(btn, halign="center", border=30)
+ self.tree = ProjectTree(pnl1)
+ self.tree.controller = self
+ pnl1.Sizer.append1x(self.tree)
+ pnl2 = self.Panel2
+ self.pgfEditors = dabo.ui.dPageFrame(pnl2, PageCount=0)
+ pnl2.Sizer.append1x(self.pgfEditors)
+
+ def editFile(self, pth):
+ pg = self.pgfEditors.appendPage(TextEditorPage)
+ pg.openFile(pth)
+ self.pgfEditors.SelectedPage = pg
+
+
+ def onOpenProject(self, evt):
+ self.openProject()
+
+
+ def openProject(self):
+ pjd = dabo.ui.getDirectory(_("Select Project Base"))
+ if pjd:
+ self.tree.makeDirTree(pjd, ignored=["*pyc", "*~"],
expand=False)
+ self.tree.getRootNode().Expanded = True
+
+
def main():
app = dabo.dApp()
app.MainFormClass = StudioForm
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]