-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dmitry Ponyatov <dponyatov@gmail.com>
- Loading branch information
Showing
12 changed files
with
641 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
\secrel{GUI /wxPython/}\label{wx}\secdown | ||
|
||
\lst{gui/gui00.py}{language=Python} | ||
|
||
\secrel{GUI фрейм} | ||
|
||
\lst{gui/gui01.py}{language=Python} | ||
|
||
\secrel{Editor: окно редактора}\secdown | ||
|
||
\lst{gui/gui02.py}{language=Python} | ||
|
||
\secrel{Меню} | ||
|
||
\lst{gui/gui03.py}{language=Python} | ||
|
||
\secrel{Область редактора} | ||
|
||
\lst{gui/gui04.py}{language=Python} | ||
|
||
\secup | ||
|
||
\secrel{Запуск системы} | ||
|
||
\lst{gui/gui05.py}{language=Python} | ||
|
||
\secup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import wx,wx.stc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class GUI(Frame): | ||
def __init__(self,V): | ||
Frame.__init__(self, V) | ||
self.app = wx.App() | ||
self['main' ] = self.main = Editor(V) | ||
self['stack'] = self.stack = Editor(V+'.stack') | ||
self['words'] = self.words = Editor(V+'.words') | ||
def start(self): | ||
self.main.Show() | ||
self.main.onUpdate(None) | ||
self.app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Editor(GUI,wx.Frame): | ||
def __init__(self,V): | ||
Frame.__init__(self, V) | ||
wx.Frame.__init__(self,parent=None,title=V) | ||
self.initMenu() | ||
self.initEditor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
def initMenu(self): | ||
self.menubar = wx.MenuBar() | ||
self.SetMenuBar(self.menubar) | ||
# file | ||
self.file = wx.Menu() | ||
self.menubar.Append(self.file,'&File') | ||
# file/save | ||
self.file.save = self.file.Append(\ | ||
wx.ID_SAVE,'&Save') | ||
self.Bind(wx.EVT_MENU,self.onSave,self.file.save) | ||
# file/quit | ||
self.file.quit = self.file.Append(\ | ||
wx.ID_EXIT,'&Quit') | ||
self.Bind(wx.EVT_MENU,self.onQuit,self.file.quit) | ||
# debug | ||
self.debug = wx.Menu() | ||
self.menubar.Append(self.debug,'&Debug') | ||
self.debug.update = self.debug.Append(\ | ||
wx.ID_REFRESH,'&Update\tF12') | ||
self.Bind(wx.EVT_MENU,\ | ||
self.onUpdate,self.debug.update) | ||
# debug/stack | ||
self.debug.stack = self.debug.Append(\ | ||
wx.ID_ANY,'&Stack\tF9',kind=wx.ITEM_CHECK) | ||
self.Bind(wx.EVT_MENU,\ | ||
self.onStack,self.debug.stack) | ||
# debug/words | ||
self.debug.words = self.debug.Append(\ | ||
wx.ID_ANY,'&Words\tF8',kind=wx.ITEM_CHECK) | ||
self.Bind(wx.EVT_MENU,\ | ||
self.onWords,self.debug.words) | ||
# help | ||
self.help = wx.Menu() | ||
self.menubar.Append(self.help,'&Help') | ||
self.help.about = self.help.Append(\ | ||
wx.ID_ABOUT,'&About\tF1') | ||
self.Bind(wx.EVT_MENU,\ | ||
self.onAbout,self.help.about) | ||
def onSave(self,e): | ||
with open(self.val,'w') as file: | ||
file.write(self.editor.GetValue()) | ||
def onQuit(self,e): | ||
vm['gui'].stack.Close() | ||
vm['gui'].words.Close() | ||
vm['gui'].main.Close() | ||
def onUpdate(self,e): | ||
vm['gui'].stack.editor.SetValue(\ | ||
vm.dump(voc=False)) | ||
vm['gui'].words.editor.SetValue(\ | ||
vm.dump(voc=True )) | ||
def onAbout(self,e): | ||
with open('README.md') as file: | ||
info = file.read() | ||
wx.MessageBox(info,'About',\ | ||
wx.OK|wx.ICON_INFORMATION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Editor(GUI,wx.Frame): | ||
def __init__(self,V): | ||
... | ||
self.initEditor() | ||
|
||
def initEditor(self): | ||
self.editor = wx.stc.StyledTextCtrl(self) | ||
self.font = wx.Font(14, | ||
wx.FONTFAMILY_MODERN, | ||
wx.FONTSTYLE_NORMAL, | ||
wx.FONTWEIGHT_BOLD) | ||
self.editor.StyleSetSpec( | ||
wx.stc.STC_STYLE_DEFAULT, | ||
"face:%s,size:%d" % ( | ||
self.font.GetFaceName(), | ||
self.font.GetPointSize() | ||
)) | ||
try: | ||
with open(self.val,'r') as file: | ||
self.editor.SetValue(file.read()) | ||
except IOError: pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if __name__ == '__main__': | ||
infiles = sys.argv[1:] ; print infiles | ||
for i in infiles: | ||
vm // String(open(i).read()) ; INTERPRET() | ||
# REPL(vm) | ||
vm['gui'] = GUI( | ||
re.sub(r'\.[a-z]+$',r'.ml',sys.argv[0])) | ||
vm['gui'].start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# metaL: homoiconic metaprogramming language /metacircular model/ | ||
\ (c) Dmitry Ponyatov <dponyatov@gmail.com> CC BY-NC-ND | ||
|
||
\ FORTH line comments can be used | ||
|
||
\ number literals test | ||
|
||
-01 +02.30 -4e+5 0xDeadBeef 0b1101 ? . ? |
Oops, something went wrong.