def main(argv=None): """ """ if not argv: argv = sys.argv[:] gui = False if len(argv) == 1: file = argv[0] elif len(argv) == 2 and argv[0] == 'gui': gui = True file = argv[1] else: print u'Naudojimas: pyemu <failas>' sys.exit(1) if gui: pyemu.gui.start_gui(file) else: def stdin(): return raw_input('INPUT: ') def stdout(block): for i in range(0, len(block), 8): print 'Word {0:2}: "{1}"'.format(i/8, block[i:i+8]) rm = RealMachine() rm.load_virtual_machine(file, stdin, stdout) for name in file_system.get_files(): print 'Failas {0}'.format(name) rm.processor.execute()
def getFileButtons(self): if self.File_button != None: for i in range(len(self.File_button)): self.fgs2.Hide(self.File_button[i]) self.File_button = [] files = file_system.get_files() for i in range(len(files)): self.File_button.append(wx.Button(self, -1, files[i])) self.Bind(wx.EVT_BUTTON, self.get_GetFile(i), self.File_button[i]) for i in range(len(self.File_button)): self.fgs2.Add(self.File_button[i]) self.fgs2.Layout()
def getFileInfo(self, fileNr): content = [] files = file_system.get_files() print ' '.join(files) if len(files)-1 < fileNr: stdout("Šis failas dar nesukurtas") else: file_name = files[fileNr] files[fileNr] = file_system.open(files[fileNr]) try: file_content = '\n'.join(files[fileNr].data) except Exception, e: pass self.fileFrame = FileInfoFrame(self) app.SetTopWindow(self.fileFrame) self.fileFrame.file_name.SetLabel(str(file_name)) self.fileFrame.file_contents.SetValue(str(file_content)) self.fileFrame.Centre() self.fileFrame.Show()