[Pybrainsim-activity] SF.net SVN: pybrainsim:[129] trunk/src/PyBrainSimGUI.pyw
Status: Planning
Brought to you by:
rgoj
From: <rg...@us...> - 2009-09-13 23:11:52
|
Revision: 129 http://pybrainsim.svn.sourceforge.net/pybrainsim/?rev=129&view=rev Author: rgoj Date: 2009-09-13 23:11:44 +0000 (Sun, 13 Sep 2009) Log Message: ----------- * Adding a file that runs the GUI menu, that for now does only that, but will soon become the main PyBrainSim script overriding the old one. Added Paths: ----------- trunk/src/PyBrainSimGUI.pyw Added: trunk/src/PyBrainSimGUI.pyw =================================================================== --- trunk/src/PyBrainSimGUI.pyw (rev 0) +++ trunk/src/PyBrainSimGUI.pyw 2009-09-13 23:11:44 UTC (rev 129) @@ -0,0 +1,121 @@ +#!/usr/bin/python + +# PyBrainSim +# Copyright 2009 Roman Goj +# +# This file is part of PyBrainSim. +# +# PyBrainSim is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# PyBrainSim is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# PyBrainSim. If not, see <http://www.gnu.org/licenses/>. + +""" +PyBrainSim is an interactive tool for the simulation and visualization of the +electromagnetic activity of the brain, currently under development. + +This script allows you to choose from a few example simulations, ranging from +adding numbers to neural mass models. + +pybrainsim.sourceforge.net +""" + +import wx +from wx import xrc + +class PyBrainSimGUI(wx.App): + def OnInit(self): + self.res = xrc.XmlResource("PyBrainSimGUI.xrc") + #self.InitFrame() + #self.InitMenu() + #self.InitEverythingElse() + + self.frame = self.res.LoadFrame(None, "menuFrame") + self.frame.Bind(wx.EVT_BUTTON, self.menuButton1, id=xrc.XRCID("menuButton1")) + self.frame.Bind(wx.EVT_BUTTON, self.menuButtonQuit, id=xrc.XRCID("menuButtonQuit")) + #self.panel = xrc.XRCCTRL(self.frame, "MainPanel") + #self.first_arg = xrc.XRCCTRL(self.panel, "FirstArg") + #self.second_arg = xrc.XRCCTRL(self.panel, "SecondArg") + #self.result = xrc.XRCCTRL(self.panel, "Result") + #self.first_arg.SetValue("Hi") + #self.second_arg.SetValue("You") + #self.result.SetValue("man") + #self.menuBar = self.res.LoadMenuBar("MenuBar") + #self.frame.SetMenuBar(self.menuBar) + #sizer = self.panel.GetSizer() + #sizer.Fit(self.frame) + #sizer.SetSizeHints(self.frame) + self.frame.Show() + return True + + def menuButton1(self, control): + print "Hullo World!" + + def menuButtonQuit(self, control): + self.Exit() + + #def InitFrame(self): + # self.frame = self.res.LoadFrame(None, "MainFrame") + # self.panel = xrc.XRCCTRL(self.frame, "MainPanel") + # self.first_arg = xrc.XRCCTRL(self.panel, "FirstArg") + # self.second_arg = xrc.XRCCTRL(self.panel, "SecondArg") + # self.result = xrc.XRCCTRL(self.panel, "Result") + # self.first_arg.SetValue("Hi") + # self.second_arg.SetValue("You") + # self.result.SetValue("man") + #def InitMenu(self): + # self.menuBar = self.res.LoadMenuBar("MenuBar") + # self.frame.Bind(wx.EVT_MENU, self.Add, id=xrc.XRCID("AddMenuItem")) + # self.frame.Bind(wx.EVT_MENU, self.Subtract, id=xrc.XRCID("SubtractMenuItem")) + # self.frame.Bind(wx.EVT_MENU, self.Multiply, id=xrc.XRCID("MultiplyMenuItem")) + # self.frame.Bind(wx.EVT_MENU, self.Divide, id=xrc.XRCID("DivideMenuItem")) + # self.frame.SetMenuBar(self.menuBar) + #def InitEverythingElse(self): + # sizer = self.panel.GetSizer() + # sizer.Fit(self.frame) + # sizer.SetSizeHints(self.frame) + # self.frame.Show() + #def InitArgs(self): + # try: + # self.first = float(self.first_arg.GetValue()) + # except ValueError: + # return self.BadFloatValue(self.first_arg) + # try: + # self.second = float(self.second_arg.GetValue()) + # except ValueError: + # return self.BadFloatValue(self.second_arg) + # return True + #def BadFloatValue(self, control): + # dlg = wx.MessageDialog(self.frame, "I can't convert this to float.", + # 'Conversion error', wx.OK | wx.ICON_ERROR) + # dlg.ShowModal() + # dlg.Destroy() + # control.SetFocus() + # control.SetSelection(-1, -1) + # return False + #def Add(self, evt): + # if self.InitArgs(): + # self.result.SetValue(str(self.first + self.second)) + #def Subtract(self, evt): + # if self.InitArgs(): + # self.result.SetValue(str(self.first - self.second)) + #def Multiply(self, evt): + # if self.InitArgs(): + # self.result.SetValue(str(self.first * self.second)) + #def Divide(self, evt): + # if self.InitArgs(): + # if self.second != 0: + # self.result.SetValue(str(self.first / self.second)) + # else: + # self.result.SetValue("#ERROR") + +if __name__ == '__main__': + app = PyBrainSimGUI(0) + app.MainLoop() Property changes on: trunk/src/PyBrainSimGUI.pyw ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |