class TFM_Frame(wx.Frame): def __init__(self, parent, id, title, size, pos): wx.Frame.__init__(self, parent, id, title, pos, size) self.VERSION_TYPE = "Version: Alpha - 0.3.1" self.addMenu() self.HotKeyMachine = HotKeys() self.mySettings = Settings(self, "Settings - More options coming soon") self.url = "" # Hook the new game selection option prior to loading the game self.Panel = MyPanel(self, "http://www.transformice.com/TransformiceChargeur.swf") self.Show(True) # thread.start_new_thread(self.checkUpdates, ()) def getSize(self): return global_size def addMenu(self): self.Menu = Menu() self.Menu.setStatics() ##################### Bind the Menu Statics ########################## self.Bind(wx.EVT_MENU, self.onCredits, self.Menu.creditsMenu) self.Bind(wx.EVT_MENU, self.onHelp, self.Menu.helpMenu) self.Bind(wx.EVT_MENU, self.onExit, self.Menu.quitMenu) self.Bind(wx.EVT_MENU, self.alignNorth, self.Menu.alignItem.MenuItems[1]) self.Bind(wx.EVT_MENU, self.alignSouth, self.Menu.alignItem.MenuItems[2]) self.Bind(wx.EVT_MENU, self.alignEast, self.Menu.alignItem.MenuItems[3]) self.Bind(wx.EVT_MENU, self.alignWest, self.Menu.alignItem.MenuItems[4]) self.Bind(wx.EVT_MENU, self.alignNorthEast, self.Menu.alignItem.MenuItems[5]) self.Bind(wx.EVT_MENU, self.alignNorthWest, self.Menu.alignItem.MenuItems[6]) self.Bind(wx.EVT_MENU, self.alignSouthEast, self.Menu.alignItem.MenuItems[7]) self.Bind(wx.EVT_MENU, self.alignSouthWest, self.Menu.alignItem.MenuItems[8]) self.Bind(wx.EVT_MENU, self.alignNeutral, self.Menu.alignItem.MenuItems[0]) self.Bind(wx.EVT_MENU, self.setZoom, self.Menu.zoomMenu) self.Bind(wx.EVT_MENU, self.initRefresh, self.Menu.refreshMenu) self.Bind(wx.EVT_MENU, self.initPause, self.Menu.pauseMenu) self.Bind(wx.EVT_MENU, self.initFS, self.Menu.fsMenu) self.Bind(wx.EVT_MENU, self.pictionaryHK, self.Menu.hkItem.MenuItems[0]) self.Bind(wx.EVT_MENU, self.deathmatchHK, self.Menu.hkItem.MenuItems[1]) self.Bind(wx.EVT_MENU, self.shamanHK, self.Menu.hkItem.MenuItems[2]) self.Bind(wx.EVT_MENU, self.transformapHK, self.Menu.hkItem.MenuItems[3]) self.Bind(wx.EVT_MENU, self.tribeHouseHK, self.Menu.hkItem.MenuItems[4]) self.Bind(wx.EVT_MENU, self.eventHK, self.Menu.hkItem.MenuItems[5]) self.Bind(wx.EVT_MENU, self.disableHK, self.Menu.hkItem.MenuItems[6]) self.Bind(wx.EVT_MENU, self.initScrn, self.Menu.scrnMenu) self.Bind(wx.EVT_MENU, self.onSettings, self.Menu.settingMenu) for x in range(13): self.Bind(wx.EVT_MENU, self.saveXML, self.Menu.saveItem.MenuItems[x]) self.SetMenuBar(self.Menu.MenuBar) def onExit(self, event): self.Close() def onCredits(self, event): About(self.VERSION_TYPE) def alignNeutral(self, event): Save("MapSaves/Settings.csv", "0", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(0) def alignNorth(self, event): Save("MapSaves/Settings.csv", "4", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(4) def alignSouth(self, event): Save("MapSaves/Settings.csv", "8", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(8) def alignEast(self, event): Save("MapSaves/Settings.csv", "2", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(2) def alignWest(self, event): Save("MapSaves/Settings.csv", "3", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(3) def alignNorthEast(self, event): Save("MapSaves/Settings.csv", "6", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(6) def alignNorthWest(self, event): Save("MapSaves/Settings.csv", "5", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(5) def alignSouthEast(self, event): Save("MapSaves/Settings.csv", "10", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(10) def alignSouthWest(self, event): Save("MapSaves/Settings.csv", "9", "Align", 0).injectCSV() self.Panel.flash._set_AlignMode(9) def setZoom(self, event): self.Panel.flash._set_Scale("noscale") def initRefresh(self, event): #Kills Current Panel completely, and inits a new one complete with flashy goodness. self.Panel.Destroy() self.Panel = MyPanel(self, "http://www.transformice.com/TransformiceChargeur.swf") self.SetSize(global_size) self.Panel.setHotKeyId(self.HotKeyMachine.returnLastKnownHotKeyVal()) if(self.IsMaximized()): self.Restore() self.Maximize() def initPause(self, event): if not self.Panel.IsFrozen(): self.Panel.Freeze() else: self.Panel.Thaw() def initFS(self, event): if self.IsFullScreen(): self.ShowFullScreen(False) else: self.ShowFullScreen(True) def onHelp(self, event): webbrowser.open_new("https://github.com/Raffprta/wxOccultism/blob/master/README.md") def pictionaryHK(self,event): self.Panel.setHotKeyId(0) self.HotKeyMachine.setLastKnownHotKeyVal(0) def deathmatchHK(self, event): self.Panel.setHotKeyId(1) self.HotKeyMachine.setLastKnownHotKeyVal(1) def shamanHK(self, event): self.Panel.setHotKeyId(2) self.HotKeyMachine.setLastKnownHotKeyVal(2) def transformapHK(self, event): self.Panel.setHotKeyId(3) self.HotKeyMachine.setLastKnownHotKeyVal(3) def tribeHouseHK(self,event): self.Panel.setHotKeyId(4) self.HotKeyMachine.setLastKnownHotKeyVal(4) def eventHK(self, event): self.Panel.setHotKeyId(5) self.HotKeyMachine.setLastKnownHotKeyVal(5) def disableHK(self, event): self.Panel.setHotKeyId(-1) self.HotKeyMachine.setLastKnownHotKeyVal(5) def saveXML(self, event): getMenuLength = len(self.Menu.saveItem.MenuItems) for x in range(getMenuLength): if(self.Menu.saveItem.MenuItems[x].GetId() == event.GetId()): slotx = wx.GetTextFromUser("Enter your Map's XML to be saved or otherwise retrieve.", default_value=Load("MapSaves/Slots.csv").returnCSVData(x)) slot_name = wx.GetTextFromUser("Enter the name you wish to call your slot.", default_value=Load("MapSaves/Slots.csv").returnName(x)) if len(slotx) and len(slot_name) > 3: Save("MapSaves/Slots.csv", slotx,slot_name, x).injectCSV() self.Menu.saveItem.SetLabel(300+x, slot_name) elif (slotx).strip() != "" or slot_name.strip() !="": wx.MessageBox("Something went wrong, was your entered input at least 4 characters?") def initScrn(self, event): #Gets absolute size of the flash, which is the same size as the frame. width, height = self.Panel.flash.GetSize() #The absolute position on the screen, of the flash. start_x, start_y = self.Panel.flash.GetScreenPositionTuple() #The whole screen's pixels. dcScreen = wx.ScreenDC() #Bitmap created as shell with the width/height. bitmap = wx.EmptyBitmap(width, height) #Sets up a Memory device. memDC = wx.MemoryDC() #Sets uit up so it can be future blitted. memDC.SelectObject(bitmap) #Blit our rect. DST - > SRC memDC.Blit(0, 0, width, height, dcScreen, start_x, start_y) #Converts to Image memDC.SelectObject(wx.NullBitmap) image = bitmap.ConvertToImage() #Access' path and Saves. string = Load("MapSaves/Settings.csv").returnCSVData(1)+str(time.time())+".png" image.SaveFile(string, wx.BITMAP_TYPE_PNG) wx.MessageBox("A Screenshot was successfully saved to to: "+string+". Wait until the next release for uploads to IMGUR hopefully (depending if I can get API access).") def checkUpdates(self): response = urllib2.urlopen("https://dl.dropboxusercontent.com/u/38957363/CHANGE.txt") version_online = response.read() yesNo = None if(self.VERSION_TYPE != version_online): msg = wx.MessageDialog(None, "A new version of wxOccultism is available! You are currently using: "+self.VERSION_TYPE+". \n Download version: "+version_online+" by pressing Yes to automatically update to the new version.", style=wx.YES_NO) yesNo = msg.ShowModal() if(yesNo == wx.ID_YES): wx.MessageBox("The download & update process will now commence. Do not close the standalone until the notifier announces the download's completion.") self.HotKeyMachine.setDownloadable(True) AutoUpdate() thread.exit_thread() #Kills the Thread that was called. def onSettings(self, event): #Re-init our static Settings as it will be destroyed on close. self.mySettings = Settings(self, "Settings - More options coming soon") self.mySettings.Show() def proxyGetUsername(self): return self.mySettings.getUsername() def proxyGetPictionaryDelay(self): return self.mySettings.getPictionaryDelay() def proxyGetOffSetF1(self): return self.mySettings.getOffSetF1() def proxyGetOffSetF2(self): return self.mySettings.getOffSetF2() def proxyGetOffSetF3(self): return self.mySettings.getOffSetF3() def proxyGetOffSetF4(self): return self.mySettings.getOffSetF4()