Advertisement
Guest User

DavidG

a guest
Jan 20th, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.34 KB | None | 0 0
  1. import wx
  2. import os
  3. from textwrap import fill
  4. import webbrowser
  5.  
  6.  
  7.  
  8. class MainFrame(wx.Frame):
  9.     def __init__(self, parent,id):
  10.         wx.Frame.__init__(self, parent,id,'PRIZM Disassembler', size=(660,590))
  11.    
  12.     self.SetMinSize((400,300))
  13.    
  14.     self.inputfocus = 1
  15.     self.outputfocus = 0
  16.     self.AsmReadOnly = 0
  17.    
  18.     def getG3Adata(event):
  19.         dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", 'g3a Files (*.g3a)|*.g3a', wx.OPEN)
  20.         if dlg.ShowModal() == wx.ID_OK:
  21.             self.filename=dlg.GetFilename()
  22.             self.dirname=dlg.GetDirectory()
  23.  
  24.             # Open the file, read the contents and set them into
  25.             # the text edit window
  26.             filehandle=open(os.path.join(self.dirname, self.filename),'r')
  27.             filehandle.close()
  28.  
  29.             self.SetTitle('PRIZM Disassembler - '+self.filename)
  30.            
  31.             hexProgram = fill(open(self.filename, "rb").read().encode("hex"),16)
  32.            
  33.             self.inputText.SetValue(self.inputText.GetValue() + hexProgram[60927:(len(hexProgram)-8)])
  34.    
  35.     def hex2dec(s): #Converts Decimal Numbers to Hexadecimal Number
  36.         return int(s, 16)  
  37.        
  38.     def OnAbout(event):
  39.         description = "PRIZM Disassembler is a very basic disassembler for the Casio Prizm. PRIZM Disassembler is not affiliated in any way with Casio\n\nThanks to 'JosJuice' and 'Goplat' with database help."
  40.         info = wx.AboutDialogInfo()
  41.  
  42.         info.SetName('PRIZM Disassembler')
  43.         info.SetVersion('1.0.1')
  44.         info.SetDescription(description)
  45.         info.SetCopyright('(C) 2010 David Gomes')
  46.         info.SetWebSite('http://www.davidgom.co.cc')
  47.         info.AddDeveloper('David Gomes')
  48.         info.AddArtist('David Gomes')
  49.  
  50.         wx.AboutBox(info)  
  51.        
  52.     def OnGetOnlineHelp(event):
  53.         webbrowser.open('http://www.omnimaga.org/index.php?board=146.0')
  54.    
  55.     self.dirname = ''
  56.     def OnSaveASM(event):
  57.         # Save away the edited text
  58.         # Open the file, do an RU sure check for an overwrite!
  59.         dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "Assembly files (*.asm)|*.asm", \
  60.                 wx.SAVE | wx.OVERWRITE_PROMPT)
  61.         if dlg.ShowModal() == wx.ID_OK:
  62.             # Grab the content to be saved
  63.             itcontains = self.outputText.GetValue()
  64.  
  65.             # Open the file for write, write, close
  66.             self.filename=dlg.GetFilename()
  67.             self.dirname=dlg.GetDirectory()
  68.             filehandle=open(os.path.join(self.dirname, self.filename),'w')
  69.             filehandle.write(itcontains)
  70.             filehandle.close()
  71.             self.SetTitle('PRIZM Disassembler - '+self.filename)
  72.         # Get rid of the dialog to keep things tidy
  73.         dlg.Destroy()
  74.     filters = 'Text files (*.txt)|*.txt|Hexadecimal files (*.hex)|*.hex'
  75.    
  76.     def OnSaveHEX(event):
  77.         # Save away the edited text
  78.         # Open the file, do an RU sure check for an overwrite!
  79.         dlg = wx.FileDialog(self, "Choose a file", self.dirname,"", filters, \
  80.                 wx.SAVE | wx.OVERWRITE_PROMPT)
  81.         if dlg.ShowModal() == wx.ID_OK:
  82.             # Grab the content to be saved
  83.             itcontains = self.inputText.GetValue()
  84.  
  85.             # Open the file for write, write, close
  86.             self.filename=dlg.GetFilename()
  87.             self.dirname=dlg.GetDirectory()
  88.             filehandle=open(os.path.join(self.dirname, self.filename),'w')
  89.             filehandle.write(itcontains)
  90.             filehandle.close()
  91.             self.SetTitle('PRIZM Disassembler - '+self.filename)
  92.         # Get rid of the dialog to keep things tidy
  93.         dlg.Destroy()
  94.    
  95.    
  96.     def OnOpen(event):
  97.         # In this case, the dialog is created within the method because
  98.         # the directory name, etc, may be changed during the running of the
  99.         # application. In theory, you could create one earlier, store it in
  100.         # your frame object and change it when it was called to reflect
  101.         # current parameters / values
  102.         dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", filters, wx.OPEN)
  103.         if dlg.ShowModal() == wx.ID_OK:
  104.             self.filename=dlg.GetFilename()
  105.             self.dirname=dlg.GetDirectory()
  106.  
  107.             # Open the file, read the contents and set them into
  108.             # the text edit window
  109.             filehandle=open(os.path.join(self.dirname, self.filename),'r')
  110.             self.inputText.SetValue(filehandle.read())
  111.             filehandle.close()
  112.  
  113.             # Report on name of latest file read
  114.             self.SetTitle('PRIZM Disassembler - '+self.filename)
  115.             # Later - could be enhanced to include a "changed" flag whenever
  116.             # the text is actually changed, could also be altered on "save" ...
  117.         dlg.Destroy()
  118.     def NewFile(event):
  119.         dial = wx.MessageDialog(None, 'Are you sure to create a new file?', 'New File',
  120.             wx.YES_NO | wx.ICON_QUESTION)
  121.  
  122.         if dial.ShowModal() == wx.ID_YES:
  123.             self.inputText.SetValue('')
  124.             self.outputText.SetValue('')
  125.             self.SetTitle('Assembly')
  126.    
  127.     def OnQuit(event):
  128.         dial = wx.MessageDialog(None, 'Are you sure to quit?', 'Exit PRIZM Disassembler',
  129.             wx.YES_NO | wx.ICON_QUESTION)
  130.         if dial.ShowModal() == wx.ID_YES:
  131.             self.Destroy()
  132.    
  133.     def Num2Hex(event):
  134.         DecimalInput=wx.TextEntryDialog(None, "Enter the decimal:", 'Decimal to Hexadecimal', 'Enter decimal...')
  135.         if DecimalInput.ShowModal()==wx.ID_OK:
  136.             Decimal=int(DecimalInput.GetValue())
  137.             hexCode = ((hex(Decimal)).upper())[2:]
  138.             self.inputText.SetValue(self.inputText.GetValue() + str(hexCode))
  139.            
  140.     def Hex2Num(event):
  141.         HexInput=wx.TextEntryDialog(None, "Enter the Hexadecimal code:", 'Hexadecimal to Decimal', 'Enter hexadecimal code...')
  142.         if HexInput.ShowModal()==wx.ID_OK:
  143.             Hex=HexInput.GetValue()
  144.             hexstring=hex2dec(Hex)
  145.             self.inputText.SetValue(self.inputText.GetValue() + str(hexstring))
  146.            
  147.     def GiveInputFocus(event):
  148.         self.inputfocus = 1
  149.    
  150.     def RemoveInputFocus(event):
  151.         self.inputfocus = 0
  152.        
  153.     def GiveOutputFocus(event):
  154.         self.outputfocus = 1
  155.    
  156.     def RemoveOutputFocus(event):
  157.         self.outputfocus = 0
  158.    
  159.     def SelectAll(event):
  160.         if self.inputfocus == 1:
  161.             self.inputText.SelectAll()
  162.         if self.outputfocus == 1:
  163.             self.outputText.SelectAll()
  164.    
  165.     def Undo(event):
  166.         if self.inputfocus == 1:
  167.             self.inputText.Undo()
  168.         if self.outputfocus == 1:
  169.             self.outputText.Undo()
  170.    
  171.     def Redo(event):
  172.         if self.inputfocus == 1:
  173.             self.inputText.Redo()
  174.         if self.outputfocus == 1:
  175.             self.outputText.Redo()
  176.            
  177.     def Cut(event):
  178.         if self.inputfocus == 1:
  179.             self.inputText.Cut()
  180.         if self.outputfocus == 1:
  181.             self.outputText.Cut()
  182.            
  183.     def Copy(event):
  184.         if self.inputfocus == 1:
  185.             self.inputText.Copy()
  186.         if self.outputfocus == 1:
  187.             self.outputText.Copy()
  188.            
  189.     def Paste(event):
  190.         if self.inputfocus == 1:
  191.             self.inputText.Paste()
  192.         if self.outputfocus == 1:
  193.             self.outputText.Paste()
  194.            
  195.     def Clear(event):
  196.         if self.inputfocus == 1:
  197.             self.inputText.SetValue('')
  198.         if self.outputfocus == 1:
  199.             self.outputText.SetValue('')
  200.  
  201.     def FindReplace(event):
  202.         textToFindInput=wx.TextEntryDialog(None,"Enter the text to be replaced","Find and Replace",'Enter text...')
  203.         if textToFindInput.ShowModal()==wx.ID_OK:
  204.             textToFind=textToFindInput.GetValue()
  205.             textToReplaceInput=wx.TextEntryDialog(None,"Enter the text to replace","Find and Replace",'Enter text...')
  206.             if textToReplaceInput.ShowModal()==wx.ID_OK:
  207.                 textToReplace = textToReplaceInput.GetValue()
  208.                 if self.inputfocus == 1:
  209.                     self.inputText.SetValue(self.inputText.GetValue().replace(textToFind,textToReplace))
  210.                 if self.outputfocus == 1:
  211.                     self.outputText.SetValue(self.outputText.GetValue().replace(textToFind,textToReplace))
  212.    
  213.     def CountWords(event):
  214.         if self.inputfocus == 1:
  215.             inputLength = len(self.inputText.GetValue())
  216.             charBox = wx.MessageDialog(None, 'Characters (with spaces): '+str(inputLength),'Characters/Words', wx.OK)
  217.             errorAnswer = charBox.ShowModal()
  218.             charBox.Destroy()
  219.         if self.outputfocus == 1:
  220.             outputLength = len(self.outputText.GetValue())
  221.             charBox = wx.MessageDialog(None, 'Characters (with spaces): '+str(outputLength),'Characters/Words', wx.OK)
  222.             errorAnswer = charBox.ShowModal()
  223.             charBox.Destroy()
  224.            
  225.  
  226.     #START OF GUI
  227.     panel = wx.Panel(self,size=(1366,768))
  228.    
  229.     self.inputText = wx.TextCtrl(panel,size=(715,665),style=wx.TE_MULTILINE | wx.BORDER_SUNKEN)
  230.  
  231.     self.outputText = wx.TextCtrl(panel,size=(715,665),style=wx.TE_MULTILINE | wx.BORDER_SUNKEN)
  232.    
  233.     vbox = wx.BoxSizer(wx.VERTICAL)
  234.     hbox = wx.BoxSizer() #wx.VERTICAL or DEFAULT = wx.HORIZONTAL
  235.  
  236.     hbox.Add(self.inputText,1,wx.EXPAND)
  237.     hbox.Add(self.outputText,1,wx.EXPAND)
  238.  
  239.     vbox.Add((0,0))
  240.     vbox.Add(hbox,50,wx.CENTER|wx.EXPAND)
  241.  
  242.     self.SetSizer(vbox)
  243.    
  244.     global ID_CONVERT
  245.     ID_CONVERT = 101
  246.    
  247.     self.statusbar = self.CreateStatusBar()
  248.     self.statusbar.SetFieldsCount(3)
  249.     self.statusbar.SetStatusWidths([-5, -2, -1])
  250.        
  251.     menuBar=wx.MenuBar()
  252.     file=wx.Menu()
  253.     newFileOption = file.Append(7,"New\tCtrl+N","Opens New File")
  254.    
  255.     openMenu = wx.Menu()
  256.    
  257.     openHEXOption = openMenu.Append(6,"Open Hex\tCtrl+O","Opens an Hexadecimal code")
  258.     openG3AOption = openMenu.Append(25,"Load .g3a","Loads a .g3a file")
  259.    
  260.     file.AppendMenu(-1,"Open",openMenu)
  261.    
  262.     saveMenu = wx.Menu()
  263.    
  264.     saveASMOption = saveMenu.Append(3,"Save Assembly\tCtrl+S","Saves the Assembly File")
  265.     saveHEXOption = saveMenu.Append(4,"Save Hex","Saves the Hexadecimal File")
  266.    
  267.     file.AppendMenu(-1,"Save",saveMenu)
  268.    
  269.     exitAction = file.Append(5,"Exit\tAlt+F4","Quits SH3 Disassembler")
  270.     edit = wx.Menu()
  271.     undo = edit.Append(14,'Undo\tCtrl+Z','Goes back in time')
  272.     redo = edit.Append(15,'Redo\tCtrl+Y','Goes ahead in time')
  273.     edit.AppendSeparator()
  274.     findReplaceOption = edit.Append(20,'Find and Replace\tCtrl+F','Finds and replaces text in the code')
  275.     edit.AppendSeparator()
  276.     selectAll = edit.Append(9,'Select All\tCtrl+A', 'Selects all the text')
  277.     edit.AppendSeparator()
  278.     cut = edit.Append(10,'Cut\tCtrl+X','Cuts the selected text')
  279.     copy = edit.Append(11,'Copy\tCtrl+C','Cuts the selected text')
  280.     paste = edit.Append(12,'Paste\tCtrl+V','Pastes the copied text')
  281.     edit.AppendSeparator()
  282.     lengthOption = edit.Append(23,'Words','Counts the number of characters and words')
  283.     clear = edit.Append(13,'Clear','Deletes the whole text')
  284.    
  285.    
  286.    
  287.     convert=wx.Menu()
  288.     disassembleOption = convert.Append(1,"Convert\tF5","Converts Hexadecimal to Assembly")
  289.    
  290.     tools=wx.Menu()
  291.     numToHexOption = tools.Append(18,'Decimal to Hexadecimal','Converts a decimal number to Hexadecimal')
  292.     hexToNumOption = tools.Append(19,'Hexadecimal to Decimal','Converts Hexadecimal code to a decimal number')
  293.    
  294.     help = wx.Menu()
  295.     aboutOption = help.Append(2,"About","Information about Assemblex")
  296.     onlineHelpOption = help.Append(24,"Online help","Get online help at omnimaga.org")
  297.    
  298.    
  299.     menuBar.Append(file,"File")
  300.     menuBar.Append(edit,"Edit")
  301.     menuBar.Append(convert,"Convert")
  302.     menuBar.Append(tools,"Tools")
  303.     menuBar.Append(help,"Help")
  304.     self.SetMenuBar(menuBar)
  305.    
  306.     #END OF GUI
  307.    
  308.    
  309.     equates = ['Enii','9ndd','Dndd','6nm3','2nm0','2nm1','2nm2','6nm0','6nm1','6nm2','2nm4','2nm5','2nm6','6nm4','6nm5','6nm6','80nd','81nd','1nmd','84md','85md','5nmd','0nm4','0nm5','0nm6','0nmC','0nmD','0nmE','C0dd','C1dd','C2dd','C4dd','C5dd','C6dd','C7dd','0n29','0n83','6nm8','6nm9','2nmD','3nmC','7nii','3nmE','3nmF','88ii','3nm0','3nm2','3nm3','3nm6','3nm7','4n11','4n15','2nmC','3nm4','2nm7','001A','3nmD','3nm5','4n10','6nmE','6nmF','6nmC','6nmD','0nmF','4nmF','0nm7','2nmF','2nmE','6nmB','6nmA','3nm8','3nmA','3nmB','2nm9','C9ii','CDii','6nm7','2nmB','CBii','CFii','4nm8','2nm8','C8ii','CCii','2nmA','CAii','CEii','4n04','4n05','4n24','4n25','4nmC','4n20','4n21','4nmD','4n00','4n01','4n08','4n09','4n18','4n19','4n28','4n29','8Bdd','8Fdd','89dd','8Ddd','Addd','0n03','Bddd','0n03','4n2B','4n0B','000B','0028','0048','0008','4m0E','4m1E','4m2E','4M3E','4m4E','4m8E','4m9E','4mAE','4mBE','4mCE','4mDE','4mEE','4mFE','4m07','4m17','4m27','4m37','4m47','4m87','4m97','4mA7','4mB7','4mC7','4mD7','4mE7','4mF7','4m0A','4m1A','4m2A','4m06','4m16','4m26','0038','0009','0n83','002B','0058','0018','001B','0n02','0n12','0n22','0n32','0n42','0n82','0n92','0nA2','0nB2','0nC2','0nD2','0nE2','0nF2','4n03','4n13','4n23','4n33','4n43','4n83','4n93','4nA3','4nB3','4nC3','4nD3','4nE3','4nF3','0n0A','0n1A','0n2A','4n02','4n12','4n22','C3ii']
  310.    
  311.     prizmInstructions = ['Mov #imm, Rn','Mov.W @(disp*2+PC),Rn','MOV.L @(disp*4+PC),Rn','Mov Rm, Rn','MOV.B Rm,@Rn','Mov.W Rm,@Rn','Mov.L Rm,@Rn','Mov.B @Rm,Rn','Mov.W @Rm,Rn','Mov.L @Rm,Rn','MOV.B Rm,@-Rn','MOV.W Rm,@-Rn','MOV.L Rm,@-Rn','MOV.B @Rm+,Rn','MOV.W @Rm+,Rn','MOV.L @Rm+,Rn','MOV.B R0,@(disp+Rn)','MOV.W R0,@(disp*2+Rn)','MOV.L Rm,@(disp*4+Rn)','MOV.B @(disp+Rm),R0','MOV.W @(disp*2+Rm),R0','MOV.L @(disp*4+Rm),Rn','MOV.B Rm,@(R0+Rn)','MOV.W Rm,@(R0+Rn)','MOV.L Rm,@(R0+Rn)','MOV.B @(R0+Rm),Rn','MOV.W @(R0+Rm),Rn','MOV.L @(R0+Rm),Rn','MOV.B R0,@(disp+GBR)','MOV.W R0,@(disp*2+GBR)','MOV.L R0,@(disp*4+GBR)','MOV.B @(disp+GBR),R0','MOV.W @(disp*2+GBR),R0','MOV.W @(disp*4+GBR),R0','MOVA @(disp*4+PC),R0','MOVT Rn','PREF @Rn','SWAP.B Rm,Rn','SWAP.W Rm,Rn','XTRCT Rm,Rn','ADD Rm,Rn','ADD #imm,Rn','ADDC Rm,Rn','ADDV Rm,Rn','CMP/EQ #imm,R0','CMP/EQ Rn,Rm','CMP/HS Rm,Rn','CMP/GE Rm,Rn','CMP/HI Rm,Rn','CMP/GT Rm,Rn','CMP/PZ Rn','CMP/PL Rn','CMP/STR Rm,Rn','DIV1 Rm,Rn','DIV0S Rm,Rn','DIV0U','DMULS.L Rm,Rn','DMULU.L Rm,Rn','DT Rn','EXTS.B Rm,Rn','EXTS.W Rm,Rn','EXTU.B Rm,Rn','EXTU.W Rm,Rn','MAC.L @Rm+,@Rn+','MAC.W @Rm+,@Rn+','MUL.L Rm,Rn','MULS.W Rm,Rn','MULU.W Rm,Rn','NEG Rm,Rn','NEGC Rm,Rn','SUB Rm,Rn','SUBC Rm,Rn','SUBV Rm,Rn','AND Rm,Rn','AND #imm,R0','AND.B #imm,@(R0+GBR)','NOT Rm,Rn','OR Rm,Rn','OR #imm,R0','OR.B #imm,@(R0+GBR)','TAS.B @Rn','TST Rm,Rn','TST #imm,R0','TST.B #imm,@(R0+GBR)','XOR Rm,Rn','XOR #imm,R0','XOR.B #imm,@(R0+GBR)','ROTL Rn','ROTR Rn','ROTCL Rn','ROTCR Rn','SHAD Rm,Rn','SHAL Rn','SHAR Rn','SHLD Rm,Rn','SHLL Rn','SHLR Rn','SHLL2 Rn','SHLR2 Rn','SHLL8 Rn','SHLR8 Rn','SHLR8 Rn','SHLR16 Rn','BF label','BF/S label','BT label','BT/S label','BRA label','BRAF Rn','BSR label','BSRF Rn','JMP @Rn','JSR @Rn','RTS','CLRMAC','CLRS','CLRT','LDC Rm,SR','LDC Rm,GBR','LDC Rm,VBR','LDC Rm,SSR','LDC Rm,SPC','LDC Rm,R0_BANK','LDC Rm,R1_BANK','LDC Rm,R2_BANK','LDC Rm,R3_BANK','LDC Rm,R4_BANK','LDC Rm,R5_BANK','LDC Rm,R6_BANK','LDC Rm,R7_BANK','LDC.L @Rm+,SR','LDC.L @Rm+,GBR','LDC.L @Rm+,VBR','LDC.L @Rm+,SSR','LDC.L @Rm+,SPC','LDC.L @Rm+,R0_BANK','LDC.L @Rm+,R1_BANK','LDC.L @Rm+,R2_BANK','LDC.L @Rm+,R3_BANK','LDC.L @Rm+,R4_BANK','LDC.L @Rm+,R5_BANK','LDC.L @Rm+,R6_BANK','LDC.L @Rm+,R7_BANK','LDS Rm,MACH','LDS Rm,MACL','LDS Rm,PR','LDS.L @Rm+,MACH','LDS.L @Rm+,MACL','LDS.L @Rm+,PR','LDTLB','NOP','PREF @Rn','RTE','SETS','SETT','SLEEP','STC SR,Rn','STC GBR,Rn','STC VBR,Rn','STC SSR,Rn','STC SPC,Rn','STC R0_BANK,Rn','STC R1_BANK,Rn','STC R2_BANK,Rn','STC R3_BANK,Rn','STC R4_BANK,Rn','STC R5_BANK,Rn','STC R6_BANK,Rn','STC R7_BANK,Rn','STC.L SR,@-Rn','STC.L GBR,@-Rn','STC.L VBR,@-Rn','STC.L SSR,@-Rn','STC.L SPC,@-Rn','STC.L R0_BANK,@-Rn','STC.L R1_BANK,@-Rn','STC.L R2_BANK,@-Rn','STC.L R3_BANK,@-Rn','STC.L R4_BANK,@-Rn','STC.L R5_BANK,@-Rn','STC.L R6_BANK,@-Rn','STC.L R7_BANK,@-Rn','STS MACH,Rn','STS MACL,Rn','STS PR,Rn','STS.L MACH,@-Rn','STS.L MACL,@-Rn','STS.L PR,@-Rn','TRAPA #imm']
  312.  
  313.    
  314.     global i
  315.    
  316.     def OnUpdateInputText(event):
  317.         c = self.inputText.GetValue()
  318.         d = c.replace('\n', '')
  319.         a = d.replace('\r','')
  320.         anum = len(a)
  321.        
  322.         if a=="":
  323.             self.outputText.SetValue("")
  324.        
  325.         if anum%4 == 0:
  326.             b = [a[x:x+4] for x in xrange(0,anum,4)]
  327.            
  328.             program = ""
  329.             i=0
  330.            
  331.             while i < len(b):  
  332.                 if (b[i] in equates)==True:
  333.                     equateLocation = equates.index(b[i])
  334.                     if i != 0:
  335.                         program+="\n"+(prizmInstructions[equateLocation])
  336.                     else:
  337.                         program+=(prizmInstructions[equateLocation])
  338.                     i=i+1  
  339.             self.outputText.SetValue(program)
  340.                
  341.    
  342.     #DEFINE EVENTS
  343.     self.inputText.Bind(wx.EVT_SET_FOCUS,GiveInputFocus)
  344.     self.inputText.Bind(wx.EVT_KILL_FOCUS,RemoveInputFocus)
  345.    
  346.     self.outputText.Bind(wx.EVT_SET_FOCUS,GiveOutputFocus)
  347.     self.outputText.Bind(wx.EVT_KILL_FOCUS,RemoveOutputFocus)
  348.    
  349.     self.inputText.Bind(wx.EVT_TEXT_ENTER,OnUpdateInputText)
  350.     self.Bind(wx.EVT_MENU,OnUpdateInputText, id=1)
  351.    
  352.    
  353.     self.Bind(wx.EVT_MENU,OnSaveASM,id=3)
  354.     self.Bind(wx.EVT_MENU,OnSaveHEX,id=4)
  355.    
  356.     self.Bind(wx.EVT_MENU,OnQuit,id=5)
  357.     self.Bind(wx.EVT_MENU,OnOpen,id=6)
  358.     self.Bind(wx.EVT_MENU,getG3Adata,id=25)
  359.     self.Bind(wx.EVT_MENU,NewFile,id=7)
  360.    
  361.     self.Bind(wx.EVT_MENU,SelectAll,id=9)
  362.     self.Bind(wx.EVT_MENU,Cut,id=10)
  363.     self.Bind(wx.EVT_MENU,Copy,id=11)
  364.     self.Bind(wx.EVT_MENU,Paste,id=12)
  365.     self.Bind(wx.EVT_MENU,Clear,id=13)
  366.     self.Bind(wx.EVT_MENU,Undo,id=14)
  367.     self.Bind(wx.EVT_MENU,Redo,id=15)
  368.     self.Bind(wx.EVT_MENU,FindReplace,id=20)
  369.     self.Bind(wx.EVT_MENU,CountWords,id=23)
  370.    
  371.     self.Bind(wx.EVT_MENU,Num2Hex,id=18)
  372.     self.Bind(wx.EVT_MENU,Hex2Num,id=19)
  373.    
  374.     self.Bind(wx.EVT_MENU,OnAbout,id=2)
  375.     self.Bind(wx.EVT_MENU,OnGetOnlineHelp,id=24)
  376.    
  377. if __name__=='__main__':
  378.     app=wx.PySimpleApp()
  379.     frame=MainFrame(parent=None, id= -1)
  380.     frame.Show()
  381.     frame.Maximize()   
  382.     app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement