| 1 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 2 |
#~ Imports |
|---|
| 3 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 4 |
|
|---|
| 5 |
import time |
|---|
| 6 |
from wxPython import wx |
|---|
| 7 |
from Foundation.Skinning import SkinFile |
|---|
| 8 |
|
|---|
| 9 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 10 |
#~ Definitions |
|---|
| 11 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 12 |
|
|---|
| 13 |
class MainframeMediator: |
|---|
| 14 |
def __init__(self, node): |
|---|
| 15 |
self.context = node.context |
|---|
| 16 |
|
|---|
| 17 |
def Initialize(self): |
|---|
| 18 |
wx.EVT_IDLE(self.context.application, self.OnIdle) |
|---|
| 19 |
wx.EVT_CLOSE(self.context.frame, self.OnCloseFrame) |
|---|
| 20 |
|
|---|
| 21 |
def OnIdle(self, evt): |
|---|
| 22 |
result = self.context.Model.Process(0) |
|---|
| 23 |
if not result: |
|---|
| 24 |
time.sleep(0.1) |
|---|
| 25 |
|
|---|
| 26 |
evt.RequestMore(1) |
|---|
| 27 |
evt.Skip() |
|---|
| 28 |
|
|---|
| 29 |
def OnExit(self, evt): |
|---|
| 30 |
self.context.frame.Close() |
|---|
| 31 |
|
|---|
| 32 |
def OnCloseFrame(self, evt): |
|---|
| 33 |
self.context.Model.JabberClients.clear() |
|---|
| 34 |
evt.Skip() |
|---|
| 35 |
|
|---|
| 36 |
def OnShowAccounts(self, evt): |
|---|
| 37 |
self.context.Model.Frames.AccountManager.context.frame.Show() |
|---|
| 38 |
#skin = SkinFile('AccountManagement.skin', self.context._OwnerContext('application')) |
|---|
| 39 |
|
|---|
| 40 |
def OnShowOptions(self, evt): |
|---|
| 41 |
wx.wxMessageBox("TODO: Show Options Window") |
|---|
| 42 |
#skin = SkinFile('Options.skin', self.context._OwnerContext('application')) |
|---|
| 43 |
|
|---|
| 44 |
def OnTODOItem(self, evt): |
|---|
| 45 |
wx.wxMessageBox("TODO: Not yet implemented") |
|---|