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