-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmaker.py
executable file
·153 lines (114 loc) · 4.52 KB
/
maker.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env python
import webbrowser as webView
import sys
import platform
print "Checking dependencies...\n"
try:
import wx
print "wxPython - OK ", "wxVersion:", wx.__version__
except:
print "you need to have wxPython installed !"
print "Download it at: http://www.wxpython.org/download.php"
print "the maker does not run without it !"
print "Leaving...."
sys.exit()
try:
import markdown2
print "Markdown2 - OK"
except:
print "You need to have Markdown2 installed !"
print "Download it at: http://code.google.com/p/python-markdown2/"
print "The maker does not run without it !"
print "Leaving...."
sys.exit()
import makerWxGUI
import makerSplash
import makerController
import makerProjectManager
import makerAbout
import makerCopyright
import makerErrorHandler
import makerBugReport
import makerVersion
import makerUpdateSandboxedProjects
def afterThisUpdateStatusInfo(func):
def wrapped(*args, **kwds):
self = args[0]
func(*args, **kwds)
try:
if self.projectController:
self.projectController.updateStatusInformation()
except Exception, e:
pass
return wrapped
class MakerAppController(makerController.SuperController):
def bindActions(self):
self.view.Bind( self.view.wx.EVT_MENU, self.model.viewLicense, self.view.MenuItemLicense)
self.view.Bind( self.view.wx.EVT_MENU, self.showAboutDialog, id=self.view.wx.ID_ABOUT)
self.view.Bind( self.view.wx.EVT_MENU, self.model.bugReport, self.view.MenuItemBugReport)
self.view.Bind( self.view.wx.EVT_MENU, self.model.userFeedback, self.view.MenuItemFeedback)
self.view.Bind( self.view.wx.EVT_MENU, self.model.openProjectWebsite, self.view.MenuItemWebsite,)
self.view.Bind( self.view.wx.EVT_MENU, self.model.getHelp, self.view.MenuItemTutorial)
self.view.Bind( self.view.wx.EVT_MENU, self.model.learnHTMLandCSS, self.view.MenuItemLearnHTMLandCSS,)
def showView(self):
# This is done in the project manager so we can access all
# info that is needed... especially when saving
self.model.pm.controller.loadAndSetInterfaceData()
self.view.Show(True)
self.view.SetTitle("The Maker for OS X - " + str(self.model.getVersion()))
# This works since model is a wxApp
self.model.SetTopWindow(self.view)
def showAboutDialog(self, evt):
dlg = makerAbout.MakerAbout(self.view, self.model.getVersion())
try:
dlg.ShowModal()
finally:
dlg.Destroy()
class MakerApp(wx.App):
def OnInit(self):
self.showCopyRight()
self.version = makerVersion.appVersion
self.author = ["Gerald Spreer", "Brinick Simmons", "Ian Barrow"]
self.mySplash = makerSplash.MySplashScreen()
self.mainView = makerWxGUI.create(self)
self.restart = False
self.appController = MakerAppController(self, self.mainView)
self.appController.resetAllViews()
self.errorHandler = makerErrorHandler.ErrorHandler(self.mainView)
sys.stderr = self.errorHandler
self.pm = makerProjectManager.ProjectManager(self.mainView)
self.appController.showView()
return True
def viewLicense(self, event):
webView.open("http://www.makercms.org/license/index.htm")
# ------------------------------------------------------------
def getVersion(self):
return self.version
# ------------------------------------------------------------
def getAuthors(self):
return self.author
def getHelp(self, event=None, topic="#all"):
"""Show http://www.makercms.org/tutorial/#topic in a browser."""
webView.open("http://www.makercms.org/tutorial/" + topic)
def bugReport(self, event):
makerBugReport.report()
def userFeedback(self, event):
webView.open("http://www.makercms.org/feedback/")
def openProjectWebsite(self, event):
webView.open("http://www.makercms.org")
def learnHTMLandCSS(self, event):
webView.open("http://www.makercms.org/resources/")
def showCopyRight(self):
print makerCopyright.getCopyright()
def main():
try:
converter = makerUpdateSandboxedProjects.UpdateSandboxedProjects()
converter.update()
except Exception, e:
sys.stderr.write("Unable to update 'sandboxed' projects: " + str(e) + "\n")
application = MakerApp(0)
application.MainLoop()
if application.restart == True:
main()
if __name__ == "__main__":
main()