1 |
#!/usr/bin/env python |
2 |
|
3 |
# generated by wxGlade 0.3.3 on Wed Aug 25 15:12:49 2004 |
4 |
# code ripped from Pears: http://project5.freezope.org/pears/ |
5 |
|
6 |
# $Id: fraggleDialogs.py,v 1.2 2004/08/25 22:55:17 joko Exp $ |
7 |
# $Log: fraggleDialogs.py,v $ |
8 |
# Revision 1.2 2004/08/25 22:55:17 joko |
9 |
# "url" isn't required anymore |
10 |
# |
11 |
# Revision 1.1 2004/08/25 22:45:52 joko |
12 |
# initial commit |
13 |
# |
14 |
|
15 |
import os |
16 |
|
17 |
import fraggleEngine |
18 |
from fraggleConstants import * |
19 |
|
20 |
import wx |
21 |
from wxPython.wx import * |
22 |
from FraggleHtmlWindow import FraggleHtmlWindow |
23 |
|
24 |
# begin wxGlade: dependencies |
25 |
# end wxGlade |
26 |
|
27 |
class FraggleAboutDialog(wx.Dialog): |
28 |
def __init__(self, *args, **kwds): |
29 |
# begin wxGlade: FraggleAboutDialog.__init__ |
30 |
kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
31 |
wx.Dialog.__init__(self, *args, **kwds) |
32 |
self.bitmap_2 = wx.StaticBitmap(self, -1, wx.Bitmap(os.path.join(APPLOCATION, 'res', 'netfrag179x104.gif'), wx.BITMAP_TYPE_ANY)) |
33 |
self.AboutText = FraggleHtmlWindow(self, -1) |
34 |
self.button_1 = wx.Button(self, wxID_CANCEL, "Close") |
35 |
|
36 |
self.__set_properties() |
37 |
self.__do_layout() |
38 |
# end wxGlade |
39 |
|
40 |
def __set_properties(self): |
41 |
# begin wxGlade: FraggleAboutDialog.__set_properties |
42 |
self.SetTitle("About Fraggle") |
43 |
self.AboutText.SetSize((305, 200)) |
44 |
self.button_1.SetDefault() |
45 |
# end wxGlade |
46 |
|
47 |
def __do_layout(self): |
48 |
# begin wxGlade: FraggleAboutDialog.__do_layout |
49 |
grid_sizer_2 = wx.FlexGridSizer(3, 3, 0, 0) |
50 |
grid_sizer_4 = wx.FlexGridSizer(2, 2, 8, 3) |
51 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
52 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
53 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
54 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND|wx.ALIGN_RIGHT, 0) |
55 |
grid_sizer_4.Add(self.bitmap_2, 0, 0, 0) |
56 |
grid_sizer_4.Add(self.AboutText, 1, wx.EXPAND, 0) |
57 |
grid_sizer_4.Add((20, 20), 0, 0, 0) |
58 |
grid_sizer_4.Add(self.button_1, 0, wx.ALIGN_RIGHT, 0) |
59 |
grid_sizer_2.Add(grid_sizer_4, 1, wx.EXPAND, 0) |
60 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
61 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
62 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
63 |
grid_sizer_2.Add((5, 5), 0, wx.EXPAND, 0) |
64 |
self.SetAutoLayout(1) |
65 |
self.SetSizer(grid_sizer_2) |
66 |
grid_sizer_2.Fit(self) |
67 |
grid_sizer_2.SetSizeHints(self) |
68 |
self.Layout() |
69 |
# end wxGlade |
70 |
|
71 |
# end of class FraggleAboutDialog |
72 |
|
73 |
class AboutDialog(FraggleAboutDialog): |
74 |
"""Wraps class created by wxGlade in pearsgui.""" |
75 |
def __init__(self, *args, **kwds): |
76 |
FraggleAboutDialog.__init__(self, *args, **kwds) |
77 |
|
78 |
self.AboutText.SetWindowStyle(wx.SUNKEN_BORDER) |
79 |
self.Centre() |
80 |
#global url |
81 |
#self.AboutText.urlOpener = url |
82 |
self.AboutText.urlOpener = fraggleEngine.urlOpener() |
83 |
|
84 |
#SetHTMLFonts(self.AboutText, self.GetFont()) |
85 |
|
86 |
# load the HTML |
87 |
fname = os.path.join(APPLOCATION, 'res', 'about.html.dat') |
88 |
try: |
89 |
textfile = file(fname, "r") |
90 |
text = textfile.read() |
91 |
textfile.close() |
92 |
except: |
93 |
text = "<b>Could not load data file</b>:<br>%s" % fname |
94 |
#feedsnumber = len(engine.getFeedsNames()) |
95 |
#topicsnumber = engine.getTotalTopicsCount() |
96 |
#feedssize = engine.getFeedsSize() |
97 |
#topicssize = engine.getTotalTopicsSize() |
98 |
replacements = {"netfraggleversion": NETFRAGGLEVERSION, |
99 |
"programdir": APPLOCATION, |
100 |
#"parserversion": engine.parserversion, |
101 |
#"datadir": engine.savedir, |
102 |
"pythonversion": PYTHONVERSION, |
103 |
"wxpythonversion": WXPYTHONVERSION, |
104 |
#"timesexecuted": engine.getSetting(TIMESRUN, 0), |
105 |
#"feedsnumber": feedsnumber, |
106 |
#"topicsnumber": topicsnumber, |
107 |
#"feedssize": "%.1f" % (feedssize/1024.0), |
108 |
#"topicssize": "%.1f" % (topicssize/1024.0), |
109 |
#"averagefeedsize": "%.1f" % ((feedssize+topicssize)/feedsnumber/1024.0), |
110 |
#"sessionuptime": mw.uptimeToStr(mw.getSessionUptime()), |
111 |
#"totaluptime": mw.uptimeToStr(mw.getTotalUptime()), |
112 |
#"enginetype": fraggleengine.__version__, |
113 |
} |
114 |
text = text % replacements |
115 |
self.AboutText.SetPage(text) |
116 |
|
117 |
|
118 |
|