""" NecroUIFrame: Main widget for the necrofamicon game. NecroUIFrame contains two subwindows: 1. NecroPlayFrame (left): The main frame. Normally shows a NecroMapFrame. In certain types of rooms, the NecroMapFrame is killed (or obscured) to provide a larger view of the player stash, of game instructions, etc. NecroMapFrame (left): Canvas widget with rooms drawn on it. Responds to mouse click and hover events. Left-click a room to move to it. Double-click a room to launch the quest. Click and drag to scroll the map (if it's bigger than the window). Right-click a room for detailed info on the quests (last 10, best 10, etc). 2. NecroInfoFrame (right): Has an upper and lower portion. The upper portion contains the player status. The lower portion contains information about the current location (map and room), plus the "launch quest" button. """ import os import sys import wx import traceback import Config import GameInfo import UIMap import UIInfo from Global import Log, LogException class NecroUIFrame(wx.Panel): def __init__(self, Parent, App, ID): wx.Panel.__init__(self, Parent, ID) self.SetBackgroundColour("black") self.App = App self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) #self.Bind(wx.EVT_SIZE, self.OnSize) def OnSetFocus(self, Event): Log("NecroUIFrame: Focus") def OnSize(self, Event): wx.LayoutAlgorithm().LayoutWindow(self) self.Refresh() def BuildWidgets(self): # Note: Status bar should be added here. self.MapWindow = UIMap.UIMap(self, self.App, -1) self.InfoWindow = UIInfo.UIInfo(self, self.App, -1) self.InfoWindow.BuildWidgets() Box = wx.BoxSizer(wx.HORIZONTAL) Box.Add(self.MapWindow, 7, wx.EXPAND) Box.Add(self.InfoWindow, 2, wx.EXPAND | wx.LEFT | wx.RIGHT, border = 5) self.SetAutoLayout(True) self.SetSizer(Box) self.Layout()