Commit 86f92fbb authored by kliment's avatar kliment

Merge pull request #57 from CyrilLD/master

French translation + minor gui changes
parents 88a7b10c 786bf24f
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env python
# Set up Internationalization using gettext
import gettext
gettext.install('pronterface', '/usr/share/pronterface/locale', unicode=1)
# searching for installed locales on /usr/share; uses relative folder if not found (windows)
import os, gettext
if os.path.exists('/usr/share/pronterface/locale'):
gettext.install('pronterface', '/usr/share/pronterface/locale', unicode=1)
else:
gettext.install('pronterface', './locale', unicode=1)
try:
import wx
except:
print _("WX is not installed. This program requires WX to run.")
raise
import printcore, os, sys, glob, time, threading, traceback, StringIO, gviz, traceback, cStringIO
import printcore, sys, glob, time, threading, traceback, StringIO, gviz, traceback, cStringIO
try:
os.chdir(os.path.split(__file__)[0])
except:
......@@ -272,9 +277,21 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def popmenu(self):
self.menustrip = wx.MenuBar()
# File menu
m = wx.Menu()
self.Bind(wx.EVT_MENU, self.loadfile, m.Append(-1,_("&Open..."),_(" Opens file")))
self.Bind(wx.EVT_MENU, self.do_editgcode, m.Append(-1,_("&Edit..."),_(" Edit open file")))
self.Bind(wx.EVT_MENU, self.clearOutput, m.Append(-1,_("Clear console"),_(" Clear output console")))
self.Bind(wx.EVT_MENU, self.OnExit, m.Append(wx.ID_EXIT,_("E&xit"),_(" Closes the Window")))
self.menustrip.Append(m,_("&File"))
# Settings menu
m = wx.Menu()
self.macros_menu = wx.Menu()
m.AppendSubMenu(self.macros_menu, _("&Macros"))
self.Bind(wx.EVT_MENU, self.new_macro, self.macros_menu.Append(-1, _("<&New...>")))
self.Bind(wx.EVT_MENU, lambda *e:options(self), m.Append(-1,_("&Options"),_(" Options dialog")))
if sys.platform != 'darwin':
self.Bind(wx.EVT_MENU, lambda x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,_("SFACT Settings"),_(" Adjust SFACT settings")))
try:
......@@ -283,13 +300,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except:
pass
self.Bind(wx.EVT_MENU, self.OnExit, m.Append(wx.ID_EXIT,_("E&xit"),_(" Closes the Window")))
self.menustrip.Append(m,_("&Print"))
m = wx.Menu()
self.macros_menu = wx.Menu()
m.AppendSubMenu(self.macros_menu, _("&Macros"))
self.Bind(wx.EVT_MENU, self.new_macro, self.macros_menu.Append(-1, _("<&New...>")))
self.Bind(wx.EVT_MENU, lambda *e:options(self), m.Append(-1,_("&Options"),_(" Options dialog")))
self.menustrip.Append(m,_("&Settings"))
self.update_macros_menu()
self.SetMenuBar(self.menustrip)
......@@ -306,17 +316,17 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
macroed(self.filename,self.f,self.doneediting,1)
def new_macro(self,e=None):
dialog = wx.Dialog(self,-1,_("Enter macro name"),size=(200,100))
dialog = wx.Dialog(self,-1,_("Enter macro name"),size=(260,85))
panel = wx.Panel(dialog,-1)
vbox = wx.BoxSizer(wx.VERTICAL)
wx.StaticText(panel,-1,_("Macro name:"),(8,14))
dialog.namectrl = wx.TextCtrl(panel,-1,'',(80,8),size=(100,24),style=wx.TE_PROCESS_ENTER)
dialog.namectrl = wx.TextCtrl(panel,-1,'',(110,8),size=(130,24),style=wx.TE_PROCESS_ENTER)
hbox = wx.BoxSizer(wx.HORIZONTAL)
okb = wx.Button(dialog,wx.ID_OK,_("Ok"),size=(50,24))
okb = wx.Button(dialog,wx.ID_OK,_("Ok"),size=(60,24))
dialog.Bind(wx.EVT_TEXT_ENTER,lambda e:dialog.EndModal(wx.ID_OK),dialog.namectrl)
#dialog.Bind(wx.EVT_BUTTON,lambda e:self.new_macro_named(dialog,e),okb)
hbox.Add(okb)
hbox.Add(wx.Button(dialog,wx.ID_CANCEL,_("Cancel"),size=(50,24)))
hbox.Add(wx.Button(dialog,wx.ID_CANCEL,_("Cancel"),size=(60,24)))
vbox.Add(panel)
vbox.Add(hbox,1,wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM,10)
dialog.SetSizer(vbox)
......@@ -337,7 +347,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
print _("Name '")+macro+_("' is being used by built-in command")
return
elif len([c for c in macro if not c.isalnum() and c != "_"]):
print "Macro name may contain only alphanumeric symbols and underscores"
print _("Macro name may contain only alphanumeric symbols and underscores")
return
else:
old_def = ""
......@@ -443,11 +453,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.logbox.SetEditable(0)
lrs.Add(self.logbox)
lbrs=wx.BoxSizer(wx.HORIZONTAL)
self.commandbox=wx.TextCtrl(self.panel,size=(250,30),pos=(440,420),style = wx.TE_PROCESS_ENTER)
self.commandbox=wx.TextCtrl(self.panel,size=(295,30),pos=(440,420),style = wx.TE_PROCESS_ENTER)
self.commandbox.Bind(wx.EVT_TEXT_ENTER,self.sendline)
#self.printerControls.append(self.commandbox)
lbrs.Add(self.commandbox)
self.sendbtn=wx.Button(self.panel,-1,_("Send"),pos=(700,420))
self.sendbtn=wx.Button(self.panel,-1,_("Send"),size=(55,28), pos=(700,420))
self.sendbtn.Bind(wx.EVT_BUTTON,self.sendline)
#self.printerControls.append(self.sendbtn)
lbrs.Add(self.sendbtn)
......@@ -817,6 +827,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx.CallAfter(self.logbox.AppendText,">>>"+command+"\n")
self.onecmd(str(command))
self.commandbox.SetSelection(0,len(command))
def clearOutput(self,e):
self.logbox.Clear()
def statuschecker(self):
try:
......@@ -1188,11 +1201,11 @@ class macroed(wx.Dialog):
title = wx.StaticText(self.panel,-1,title%macro_name)
#title.SetFont(wx.Font(11,wx.NORMAL,wx.NORMAL,wx.BOLD))
titlesizer.Add(title,1)
self.okb = wx.Button(self.panel, -1, ("Save"))
self.okb = wx.Button(self.panel, -1, _("Save"))
self.okb.Bind(wx.EVT_BUTTON, self.save)
self.Bind(wx.EVT_CLOSE, self.close)
titlesizer.Add(self.okb)
self.cancelb = wx.Button(self.panel, -1, ("Cancel"))
self.cancelb = wx.Button(self.panel, -1, _("Cancel"))
self.cancelb.Bind(wx.EVT_BUTTON, self.close)
titlesizer.Add(self.cancelb)
topsizer=wx.BoxSizer(wx.VERTICAL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment