def __init__(self): wx.SplashScreen.__init__( self, getImage(images.SPLASH_SCREEN), wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 100, None, -1, style=wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP) wx.EVT_CLOSE(self, self.OnClose)
def load_images(self, event): for heading in ("South", "North", "East", "West"): openedFileName = dialogs.openDialog( _("Choose an image: robot facing " + heading), _("All files (*.*)|*.*"), "", os.getcwd()) if openedFileName != "": setattr(self, "file" + heading, openedFileName) else: return () image_south = getImage(images.GREY_ROBOT_S) image_north = getImage(images.GREY_ROBOT_N) image_east = getImage(images.GREY_ROBOT_E) image_west = getImage(images.GREY_ROBOT_W) try: image_south = wx.Image(self.fileSouth).ConvertToBitmap() image_north = wx.Image(self.fileNorth).ConvertToBitmap() image_east = wx.Image(self.fileEast).ConvertToBitmap() image_west = wx.Image(self.fileWest).ConvertToBitmap() except Exception, info: print "Conversion or loading problems: can not use new images." print "info = %", info
def load_images(self, event): for heading in ("South", "North", "East", "West"): openedFileName = dialogs.openDialog( _("Choose an image: robot facing " + heading), _("All files (*.*)|*.*"), "", os.getcwd()) if openedFileName != "": setattr(self, "file" + heading, openedFileName) else: return() image_south = getImage(images.GREY_ROBOT_S) image_north = getImage(images.GREY_ROBOT_N) image_east = getImage(images.GREY_ROBOT_E) image_west = getImage(images.GREY_ROBOT_W) try: image_south = wx.Image(self.fileSouth).ConvertToBitmap() image_north = wx.Image(self.fileNorth).ConvertToBitmap() image_east = wx.Image(self.fileEast).ConvertToBitmap() image_west = wx.Image(self.fileWest).ConvertToBitmap() except Exception, info: print "Conversion or loading problems: can not use new images." print "info = %", info
def __init__(self): wx.Frame.__init__(self, None, -1, _("RUR: a Python Learning Environment"), size = (settings.SCREEN[0], settings.SCREEN[1]), style=wx.DEFAULT_FRAME_STYLE) self.raw_code = "" self.filename = "" self.world_filename = "" self.isPaused = False self.isRunning = False self.isStepped = False self.status_bar = rurStatusBar(self) self.SetStatusBar(self.status_bar) # icon on top left of window icon = wx.EmptyIcon() icon.CopyFromBitmap(getImage(images.ICON)) self.SetIcon(icon) # self.Show(True) self.window = RURnotebook(self) # win = browser.TestHtmlPanel(self.window, self) self.window.AddPage(win, _(" RUR: Read and Learn ")) # self.sash = MySashWindow(self.window, self) self.outputWindow = self.sash.output_window self.window.AddPage(self.sash, _("Robot: Code and Learn")) # See MySashWindow for the following 'shortcut' notation self.world = self.WorldDisplay.world # create a backup copy that will be used to "reset" the world self.backup_dict = {} self.backup_dict['avenues'] = self.world.av self.backup_dict['streets'] = self.world.st self.backup_dict['beepers'] = {} self.backup_dict['walls'] = [] # add a robot to start self.world.addOneRobot(name='robot') self.backup_dict['robot'] = self.world.robot_dict[ 'robot']._getInfoTuple() # create user_program object as a two-step process: create Singleton self.user_program = rur_program() # binds attributes explicitly self.user_program.myInit(self, self.world, self.WorldDisplay, self.ProgramEditor, self.world.robot_dict) # We will then be able to "link" to the one rur_program() without # having to worry about changing attributes # recreate the image so that the robot shows up. self.world.DoDrawing() self.WorldDisplay.drawImage() self.WorldDisplay.Refresh() # win = py.shell.Shell(self.window, -1, introText = "") self.window.AddPage(win, _("Python: Code and Learn")) self.sash2 = EditorSashWindow(self.window, grand_parent=self, controller=pythonChoiceWindow, top_control=True, top_control_height=40) # 40 = bouton "." btn_size[1] + 8 self.window.AddPage(self.sash2, _("Python: simple editor")) self.SetSize((settings.SCREEN[0], settings.SCREEN[1])) self.window.SetFocus() self.SendSizeEvent() # added to attempt to solve problem on MacOS wx.EVT_CLOSE(self, self.OnClose)
def __init__(self): wx.SplashScreen.__init__(self, getImage(images.SPLASH_SCREEN), wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT, 100, None, -1, style = wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP) wx.EVT_CLOSE(self, self.OnClose)
def __init__(self): wx.Frame.__init__(self, None, -1, _("RUR: a Python Learning Environment"), size=(settings.SCREEN[0], settings.SCREEN[1]), style=wx.DEFAULT_FRAME_STYLE) self.raw_code = "" self.filename = "" self.world_filename = "" self.isPaused = False self.isRunning = False self.isStepped = False self.status_bar = rurStatusBar(self) self.SetStatusBar(self.status_bar) # icon on top left of window icon = wx.EmptyIcon() icon.CopyFromBitmap(getImage(images.ICON)) self.SetIcon(icon) # self.Show(True) self.window = RURnotebook(self) # win = browser.TestHtmlPanel(self.window, self) self.window.AddPage(win, _(" RUR: Read and Learn ")) # self.sash = MySashWindow(self.window, self) self.outputWindow = self.sash.output_window self.window.AddPage(self.sash, _("Robot: Code and Learn")) # See MySashWindow for the following 'shortcut' notation self.world = self.WorldDisplay.world # create a backup copy that will be used to "reset" the world self.backup_dict = {} self.backup_dict['avenues'] = self.world.av self.backup_dict['streets'] = self.world.st self.backup_dict['beepers'] = {} self.backup_dict['walls'] = [] # add a robot to start self.world.addOneRobot(name='robot') self.backup_dict['robot'] = self.world.robot_dict[ 'robot']._getInfoTuple() # create user_program object as a two-step process: create Singleton self.user_program = rur_program() # binds attributes explicitly self.user_program.myInit(self, self.world, self.WorldDisplay, self.ProgramEditor, self.world.robot_dict) # We will then be able to "link" to the one rur_program() without # having to worry about changing attributes # recreate the image so that the robot shows up. self.world.DoDrawing() self.WorldDisplay.drawImage() self.WorldDisplay.Refresh() # win = py.shell.Shell(self.window, -1, introText="") self.window.AddPage(win, _("Python: Code and Learn")) self.sash2 = EditorSashWindow(self.window, grand_parent=self, controller=pythonChoiceWindow, top_control=True, top_control_height=40) # 40 = bouton "." btn_size[1] + 8 self.window.AddPage(self.sash2, _("Python: simple editor")) self.SetSize((settings.SCREEN[0], settings.SCREEN[1])) self.window.SetFocus() self.SendSizeEvent() # added to attempt to solve problem on MacOS wx.EVT_CLOSE(self, self.OnClose)