| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 23 |
#~ Imports |
|---|
| 24 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 25 |
|
|---|
| 26 |
import os |
|---|
| 27 |
from wxPython import html |
|---|
| 28 |
from wxSkinLayoutObject import wx, wxSkinLayoutObject, wxSkinObjectNoData |
|---|
| 29 |
|
|---|
| 30 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 31 |
#~ Class |
|---|
| 32 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 33 |
|
|---|
| 34 |
class htmlwindow(wxSkinLayoutObject, wxSkinObjectNoData): |
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
#~ Constants / Variables / Etc. |
|---|
| 37 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 38 |
|
|---|
| 39 |
default_settings = wxSkinLayoutObject.default_settings.copy() |
|---|
| 40 |
default_settings.update({ |
|---|
| 41 |
'name': __name__, |
|---|
| 42 |
'style': 'wxHW_SCROLLBAR_AUTO', |
|---|
| 43 |
#'border': None, |
|---|
| 44 |
#'address': None, |
|---|
| 45 |
#'source': None, |
|---|
| 46 |
}) |
|---|
| 47 |
|
|---|
| 48 |
ctxVars = wxSkinLayoutObject.ctxVars.copy() |
|---|
| 49 |
ctxVars.update(vars(html)) |
|---|
| 50 |
|
|---|
| 51 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 52 |
#~ Public |
|---|
| 53 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 54 |
|
|---|
| 55 |
def SkinInitialize(self): |
|---|
| 56 |
winParent = self.wxGetParentObject(wx.wxWindowPtr) |
|---|
| 57 |
Settings = map(self.wxEval, ['wxid', 'pos', 'size', 'style']) |
|---|
| 58 |
Settings.append(self.settings['name']) |
|---|
| 59 |
self.object = html.wxHtmlWindow(winParent, *Settings) |
|---|
| 60 |
self.wxInitialStandardOptions() |
|---|
| 61 |
self.wxHtmlWindowOptions() |
|---|
| 62 |
|
|---|
| 63 |
def SkinFinalize(self): |
|---|
| 64 |
self.wxFinalStandardOptions() |
|---|
| 65 |
|
|---|
| 66 |
def wxHtmlWindowOptions(self): |
|---|
| 67 |
if 'border' in self.settings: |
|---|
| 68 |
self.object.SetBorder(self.wxEval('border')) |
|---|
| 69 |
if 'address' in self.settings: |
|---|
| 70 |
self.object.LoadPage(self.settings['address']) |
|---|
| 71 |
elif 'file' in self.settings: |
|---|
| 72 |
self.object.LoadPage(os.path.abspath(self.settings['address'])) |
|---|
| 73 |
if 'source' in self.settings: |
|---|
| 74 |
source = self.wxEval('source') |
|---|
| 75 |
self.object.SetPage(source) |
|---|
| 76 |
|
|---|