-
Notifications
You must be signed in to change notification settings - Fork 0
/
wxMolGui.py
87 lines (75 loc) · 3.64 KB
/
wxMolGui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# initially generated by wxGlade 0.6.3 on Thu Jan 14 21:26:03 2010
import wx
from os.path import join
class wxMolFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP|wx.SYSTEM_MENU|wx.FRAME_TOOL_WINDOW
wx.Frame.__init__(self, *args, **kwds)
self.label_1 = wx.StaticText(self, -1, "Calc:")
self.txtInput = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER)
self.bnCalc = wx.BitmapButton(self, -1, wx.Bitmap(join("icons", "tick.xpm"), wx.BITMAP_TYPE_ANY), style=wx.BU_AUTODRAW)
self.label_2 = wx.StaticText(self, -1, "=")
self.txtOutput = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.bnCopy = wx.BitmapButton(self, -1, wx.Bitmap(join("icons", "copy.xpm"), wx.BITMAP_TYPE_ANY), style=wx.BU_AUTODRAW)
self.label_3 = wx.StaticText(self, -1, "eval:")
self.txtStatus = wx.TextCtrl(self, -1, "Copyright 2010 Hubert Hanghofer\nhttp://hubert.hanghofer.net", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH|wx.TE_RICH2|wx.TE_AUTO_URL|wx.NO_BORDER)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT_ENTER, self.on_enter, self.txtInput)
self.Bind(wx.EVT_BUTTON, self.on_enter, self.bnCalc)
self.Bind(wx.EVT_BUTTON, self.on_copy, self.bnCopy)
def __set_properties(self):
self.SetTitle("Mol Calculator")
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(wx.Bitmap(join("icons", "benzol.ico"), wx.BITMAP_TYPE_ANY))
self.SetIcon(_icon)
self.SetSize((352, 160))
self.SetBackgroundColour(wx.Colour(255, 238, 204))
self.txtInput.SetMinSize((280, 24))
self.txtInput.SetToolTipString("enter formula like CaSO4+2H2O/Ca")
self.bnCalc.SetMinSize((24, 24))
self.bnCalc.SetToolTipString("evaluate")
self.bnCalc.SetDefault()
self.txtOutput.SetMinSize((280, 24))
self.txtOutput.SetBackgroundColour(wx.Colour(255, 238, 204))
self.bnCopy.SetMinSize((24, 24))
self.bnCopy.SetToolTipString("Copy to Clipboard")
self.bnCopy.SetDefault()
self.txtStatus.SetBackgroundColour(wx.Colour(255, 238, 204))
def __do_layout(self):
grid_sizer_1 = wx.FlexGridSizer(3, 2, 4, 4)
grid_sizer_2 = wx.FlexGridSizer(1, 2, 4, 4)
grid_sizer_3 = wx.FlexGridSizer(1, 2, 4, 4)
grid_sizer_1.Add(self.label_1, 0, wx.ALIGN_RIGHT, 0)
grid_sizer_2.Add(self.txtInput, 0, 0, 0)
grid_sizer_2.Add(self.bnCalc, 0, 0, 0)
grid_sizer_1.Add(grid_sizer_2)
grid_sizer_1.Add(self.label_2, 0, wx.ALIGN_RIGHT, 0)
grid_sizer_3.Add(self.txtOutput, 0, 0, 0)
grid_sizer_3.Add(self.bnCopy, 0, 0, 0)
grid_sizer_1.Add(grid_sizer_3)
grid_sizer_1.Add(self.label_3, 0, wx.ALIGN_RIGHT, 0)
grid_sizer_1.Add(self.txtStatus, 0, wx.EXPAND, 0)
grid_sizer_1.AddGrowableRow(2)
self.SetSizer(grid_sizer_1)
self.Layout()
self.Centre()
def on_enter(self, event): # wxGlade: wxMolFrame.<event_handler>
print "Event handler `on_enter' not implemented"
event.Skip()
def on_copy(self, event): # wxGlade: wxMolFrame.<event_handler>
print "Event handler `on_copy' not implemented"
event.Skip()
def on_focus(self, event): # wxGlade: wxMolFrame.<event_handler>
print "Event handler `on_focus' not implemented"
event.Skip()
# end of class wxMolFrame
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = wxMolFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()