Commit 093f6a45 authored by kliment's avatar kliment

Merge pull request #279 from iXce/connection-rework

Connection rework, coding style rework
parents 7e2e6a51 107280b8
*.pyc
.pronsolerc
*.swp
*.bak
Some cleanup commands :
To add a space after each comma :
sed -e "s/\(\w\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\),\(\"\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\"\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\"\),\(\"\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\([)}\]]\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\([)}\]]\),\([\[{(]\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\),\([\[{(]\)/\1, \2/g" -i *.py printrun/*.py printrun/svg/*.py
To add spaces around each = :
sed -e "s/\(\w\)=\(\w\)/\1 = \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)=\(\"\)/\1 = \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)=\((\)/\1 = \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)=\((\)/\1 = \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)=\([\[{(]\)/\1 = \2/g" -i *.py printrun/*.py printrun/svg/*.py
To add spaces around each == :
sed -e "s/\(\w\)==\(\w\)/\1 == \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)==\(\"\)/\1 == \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\(\w\)==\((\)/\1 == \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\()\)==\(\w\)/\1 == \2/g" -i *.py printrun/*.py printrun/svg/*.py
sed -e "s/\()\)==\((\)/\1 == \2/g" -i *.py printrun/*.py printrun/svg/*.py
Obviously this is not a perfect solution, it WILL break the code. Juste check the diff and fix what's wrong before commiting.
......@@ -10,7 +10,7 @@ The pronterface.py now uses gettext for the messages it generates.
The corresponding pronterface.pot file is at locale/pronterface.pot
and was generated using
pygettext -o locale/pronterface.pot pronterface.py
pygettext -o locale/pronterface.pot pronterface.py printrun/pronterface_widgets.py
followed by minor edits to the generated header.
......@@ -20,14 +20,14 @@ now there is only one, for German. New ones can be created:
# Create new pronterface message catalog for a different language
newlang="es" # use the correct code for your language
mkdir -p locale/${newlang}/LC_MESSAGES
cp locale/pronterface.pot locale/${newlanguage}/LC_MESSAGES/${newlang}.po
cd locale/${newlanguage}/LC_MESSAGES/${newlang}
cp locale/pronterface.pot locale/${newlanguage}/LC_MESSAGES/pronterface.po
cd locale/${newlanguage}/LC_MESSAGES/
# Edit the .po file to add messages for newlang
msgfmt -o ${newlang}.mo ${newlang}.po
msgfmt -o pronterface.mo pronterface.po
To update a previously created message catalog from the template, use :
msgmerge -U locale/fr/LC_MESSAGES/${lang}.po locale/pronterface.pot
msgmerge -U locale/fr/LC_MESSAGES/pronterface.po locale/pronterface.pot
As currently coded, the default location for these message catalogs is
......
......@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plater\n"
"POT-Creation-Date: 2012-02-26 02:40+CET\n"
"POT-Creation-Date: 2012-08-04 21:53+CEST\n"
"PO-Revision-Date: 2012-02-26 02:41+0100\n"
"Last-Translator: Guillaume Seguin <guillaume@segu.in>\n"
"Language-Team: FR <guillaume@segu.in>\n"
......@@ -15,81 +15,81 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: plater.py:247
#: plater.py:246
msgid "Plate building tool"
msgstr "Outil d'assemblage de plateau"
#: plater.py:253
#: plater.py:252
msgid "Clear"
msgstr "Vider"
#: plater.py:254
#: plater.py:253
msgid "Load"
msgstr "Charger"
#: plater.py:256
#: plater.py:255 plater.py:258
msgid "Export"
msgstr "Exporter"
#: plater.py:259
#: plater.py:260
msgid "Done"
msgstr "Terminé"
#: plater.py:261
#: plater.py:262
msgid "Cancel"
msgstr "Annuler"
#: plater.py:263
#: plater.py:264
msgid "Snap to Z = 0"
msgstr "Poser en Z = 0"
#: plater.py:264
#: plater.py:265
msgid "Put at 100, 100"
msgstr "Placer en 100, 100"
#: plater.py:265
#: plater.py:266
msgid "Delete"
msgstr "Supprimer"
#: plater.py:266
#: plater.py:267
msgid "Auto"
msgstr "Auto"
#: plater.py:290
#: plater.py:291
msgid "Autoplating"
msgstr "Placement auto"
#: plater.py:318
#: plater.py:319
msgid "Bed full, sorry sir :("
msgstr "Le lit est plein, désolé :("
#: plater.py:328
#: plater.py:329
msgid ""
"Are you sure you want to clear the grid? All unsaved changes will be lost."
msgstr ""
"Êtes vous sur de vouloir vider la grille ? Toutes les modifications non "
"enregistrées seront perdues."
#: plater.py:328
#: plater.py:329
msgid "Clear the grid?"
msgstr "Vider la grille ?"
#: plater.py:370
#: plater.py:371
msgid "Pick file to save to"
msgstr "Choisir le fichier dans lequel enregistrer"
#: plater.py:371
#: plater.py:372
msgid "STL files (;*.stl;*.STL;)"
msgstr "Fichiers STL (;*.stl;*.STL;)"
#: plater.py:391
#: plater.py:393
msgid "wrote %s"
msgstr "%s écrit"
#: plater.py:394
#: plater.py:396
msgid "Pick file to load"
msgstr "Choisir le fichier à charger"
#: plater.py:395
#: plater.py:397
msgid "STL files (;*.stl;*.STL;)|*.stl|OpenSCAD files (;*.scad;)|*.scad"
msgstr "Fichiers STL (;*.stl;*.STL;)|*.stl|Fichiers OpenSCAD (;*.scad;)|*.scad"
This diff is collapsed.
......@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2012-02-26 02:40+CET\n"
"POT-Creation-Date: 2012-08-04 21:53+CEST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -15,79 +15,79 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
#: plater.py:247
#: plater.py:246
msgid "Plate building tool"
msgstr ""
#: plater.py:253
#: plater.py:252
msgid "Clear"
msgstr ""
#: plater.py:254
#: plater.py:253
msgid "Load"
msgstr ""
#: plater.py:256
#: plater.py:255 plater.py:258
msgid "Export"
msgstr ""
#: plater.py:259
#: plater.py:260
msgid "Done"
msgstr ""
#: plater.py:261
#: plater.py:262
msgid "Cancel"
msgstr ""
#: plater.py:263
#: plater.py:264
msgid "Snap to Z = 0"
msgstr ""
#: plater.py:264
#: plater.py:265
msgid "Put at 100, 100"
msgstr ""
#: plater.py:265
#: plater.py:266
msgid "Delete"
msgstr ""
#: plater.py:266
#: plater.py:267
msgid "Auto"
msgstr ""
#: plater.py:290
#: plater.py:291
msgid "Autoplating"
msgstr ""
#: plater.py:318
#: plater.py:319
msgid "Bed full, sorry sir :("
msgstr ""
#: plater.py:328
#: plater.py:329
msgid "Are you sure you want to clear the grid? All unsaved changes will be lost."
msgstr ""
#: plater.py:328
#: plater.py:329
msgid "Clear the grid?"
msgstr ""
#: plater.py:370
#: plater.py:371
msgid "Pick file to save to"
msgstr ""
#: plater.py:371
#: plater.py:372
msgid "STL files (;*.stl;*.STL;)"
msgstr ""
#: plater.py:391
#: plater.py:393
msgid "wrote %s"
msgstr ""
#: plater.py:394
#: plater.py:396
msgid "Pick file to load"
msgstr ""
#: plater.py:395
#: plater.py:397
msgid "STL files (;*.stl;*.STL;)|*.stl|OpenSCAD files (;*.scad;)|*.scad"
msgstr ""
This diff is collapsed.
#!/usr/bin/env python
# This file is part of the Printrun suite.
#
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Printrun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
......@@ -46,7 +46,7 @@ def evalme(s):
class stlwrap:
def __init__(self, obj, name=None):
def __init__(self, obj, name = None):
self.obj = obj
self.name = name
if name is None:
......@@ -58,7 +58,7 @@ class stlwrap:
class showstl(wx.Window):
def __init__(self, parent, size, pos):
wx.Window.__init__(self, parent, size=size, pos=pos)
wx.Window.__init__(self, parent, size = size, pos = pos)
#self.SetBackgroundColour((0, 0, 0))
#wx.FutureCall(200, self.paint)
self.i = 0
......@@ -141,7 +141,7 @@ class showstl(wx.Window):
self.i += angle
if not self.triggered:
self.triggered = 1
threading.Thread(target=self.cr).start()
threading.Thread(target = self.cr).start()
def keypress(self, event):
"""gets keypress events and moves/rotates acive shape"""
......@@ -200,9 +200,9 @@ class showstl(wx.Window):
def repaint(self, event):
dc = wx.PaintDC(self)
self.paint(dc=dc)
self.paint(dc = dc)
def paint(self, coord1="x", coord2="y", dc=None):
def paint(self, coord1 = "x", coord2 = "y", dc = None):
coords = {"x": 0, "y": 1, "z": 2}
if dc is None:
dc = wx.ClientDC(self)
......@@ -231,7 +231,7 @@ class showstl(wx.Window):
bm = wx.BitmapFromImage(im)
dcs.SelectObject(bm)
bsz = bm.GetSize()
dc.Blit(scale * m.offsets[0] - bsz[0] / 2, 400 - (scale * m.offsets[1] + bsz[1] / 2), bsz[0], bsz[1], dcs, 0, 0, useMask=1)
dc.Blit(scale * m.offsets[0] - bsz[0] / 2, 400 - (scale * m.offsets[1] + bsz[1] / 2), bsz[0], bsz[1], dcs, 0, 0, useMask = 1)
#for i in m.facets:#random.sample(m.facets, min(100000, len(m.facets))):
# dc.DrawPolygon([wx.Point(offset[0]+scale*m.offsets[0]+scale*p[0], 400-(offset[1]+scale*m.offsets[1]+scale*p[1])) for p in i[1]])
#if(time.time()-t)>5:
......@@ -242,29 +242,29 @@ class showstl(wx.Window):
class stlwin(wx.Frame):
def __init__(self, size=(800, 580), callback=None, parent=None):
wx.Frame.__init__(self, parent, title=_("Plate building tool"), size=size)
def __init__(self, size = (800, 580), callback = None, parent = None):
wx.Frame.__init__(self, parent, title = _("Plate building tool"), size = size)
self.SetIcon(wx.Icon(pixmapfile("plater.ico"), wx.BITMAP_TYPE_ICO))
self.mainsizer = wx.BoxSizer(wx.HORIZONTAL)
self.panel = wx.Panel(self, -1, size=(150, 600), pos=(0, 0))
self.panel = wx.Panel(self, -1, size = (150, 600), pos = (0, 0))
#self.panel.SetBackgroundColour((10, 10, 10))
self.l = wx.ListBox(self.panel, size=(300, 180), pos=(0, 30))
self.cl = wx.Button(self.panel, label=_("Clear"), pos=(0, 205))
self.lb = wx.Button(self.panel, label=_("Load"), pos=(0, 0))
self.l = wx.ListBox(self.panel, size = (300, 180), pos = (0, 30))
self.cl = wx.Button(self.panel, label = _("Clear"), pos = (0, 205))
self.lb = wx.Button(self.panel, label = _("Load"), pos = (0, 0))
if(callback is None):
self.eb = wx.Button(self.panel, label=_("Export"), pos=(100, 0))
self.eb = wx.Button(self.panel, label = _("Export"), pos = (100, 0))
self.eb.Bind(wx.EVT_BUTTON, self.export)
else:
self.eb = wx.Button(self.panel, label=_("Export"), pos=(200, 205))
self.eb = wx.Button(self.panel, label = _("Export"), pos = (200, 205))
self.eb.Bind(wx.EVT_BUTTON, self.export)
self.edb = wx.Button(self.panel, label=_("Done"), pos=(100, 0))
self.edb = wx.Button(self.panel, label = _("Done"), pos = (100, 0))
self.edb.Bind(wx.EVT_BUTTON, lambda e: self.done(e, callback))
self.eb = wx.Button(self.panel, label=_("Cancel"), pos=(200, 0))
self.eb = wx.Button(self.panel, label = _("Cancel"), pos = (200, 0))
self.eb.Bind(wx.EVT_BUTTON, lambda e: self.Destroy())
self.sb = wx.Button(self.panel, label=_("Snap to Z = 0"), pos=(00, 255))
self.cb = wx.Button(self.panel, label=_("Put at 100, 100"), pos=(0, 280))
self.db = wx.Button(self.panel, label=_("Delete"), pos=(0, 305))
self.ab = wx.Button(self.panel, label=_("Auto"), pos=(0, 330))
self.sb = wx.Button(self.panel, label = _("Snap to Z = 0"), pos = (00, 255))
self.cb = wx.Button(self.panel, label = _("Put at 100, 100"), pos = (0, 280))
self.db = wx.Button(self.panel, label = _("Delete"), pos = (0, 305))
self.ab = wx.Button(self.panel, label = _("Auto"), pos = (0, 330))
self.cl.Bind(wx.EVT_BUTTON, self.clear)
self.lb.Bind(wx.EVT_BUTTON, self.right)
self.sb.Bind(wx.EVT_BUTTON, self.snap)
......@@ -336,25 +336,25 @@ class stlwin(wx.Frame):
def center(self, event):
i = self.l.GetSelection()
if i != -1:
m = self.models[self.l.GetString(i)]
m.offsets = [100, 100, m.offsets[2]]
self.Refresh()
m = self.models[self.l.GetString(i)]
m.offsets = [100, 100, m.offsets[2]]
self.Refresh()
def snap(self, event):
i = self.l.GetSelection()
if i != -1:
m = self.models[self.l.GetString(i)]
m.offsets[2] = -1.0 * min(m.facetsminz)[0]
#print m.offsets[2]
self.Refresh()
m = self.models[self.l.GetString(i)]
m.offsets[2] = -1.0 * min(m.facetsminz)[0]
#print m.offsets[2]
self.Refresh()
def delete(self, event):
i = self.l.GetSelection()
if i != -1:
del self.models[self.l.GetString(i)]
self.l.Delete(i)
self.l.Select(self.l.GetCount() - 1)
self.Refresh()
del self.models[self.l.GetString(i)]
self.l.Delete(i)
self.l.Select(self.l.GetCount() - 1)
self.Refresh()
def done(self, event, cb):
try:
......@@ -368,7 +368,7 @@ class stlwin(wx.Frame):
self.Destroy()
def export(self, event):
dlg = wx.FileDialog(self, _("Pick file to save to"), self.basedir, style=wx.FD_SAVE)
dlg = wx.FileDialog(self, _("Pick file to save to"), self.basedir, style = wx.FD_SAVE)
dlg.SetWildcard(_("STL files (;*.stl;*.STL;)"))
if(dlg.ShowModal() == wx.ID_OK):
name = dlg.GetPath()
......@@ -393,7 +393,7 @@ class stlwin(wx.Frame):
print _("wrote %s") % name
def right(self, event):
dlg = wx.FileDialog(self, _("Pick file to load"), self.basedir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
dlg = wx.FileDialog(self, _("Pick file to load"), self.basedir, style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("STL files (;*.stl;*.STL;)|*.stl|OpenSCAD files (;*.scad;)|*.scad"))
if(dlg.ShowModal() == wx.ID_OK):
name = dlg.GetPath()
......@@ -443,7 +443,7 @@ class stlwin(wx.Frame):
self.Refresh()
#print time.time()-t
def load_stl_into_model(self, path, name, offset=[0, 0, 0], rotation=0, scale=[1.0, 1.0, 1.0]):
def load_stl_into_model(self, path, name, offset = [0, 0, 0], rotation = 0, scale = [1.0, 1.0, 1.0]):
newname = os.path.split(name.lower())[1]
c = 1
while newname in self.models:
......
This diff is collapsed.
......@@ -16,13 +16,13 @@ class SkeinforgeQuickEditDialog(wx.Dialog):
self.cancelButton = wx.Button(self, wx.ID_CANCEL, "")
self.Bind(wx.EVT_BUTTON, self.OnExit, self.cancelButton)
self.Bind(wx.EVT_BUTTON, self.OnSave, self.okButton)
"""
The following list determines which settings are shown.
The dictionary key is the plugin name and the value is a list of setting names as found in the corresponding .csv file for that plugin.
NOTE: Skeinforge is tightly integrated with Tkinter and there appears to be a dependency which stops radio-button values from being saved.
Perhaps this can be solved, but at the moment this dialog cannot modify radio button values. One will have to use the main Skeinforge application.
Perhaps this can be solved, but at the moment this dialog cannot modify radio button values. One will have to use the main Skeinforge application.
"""
self.moduleSettingsMap = {
'dimension':['Filament Diameter (mm):','Retraction Distance (millimeters):', 'Retraction Distance (millimeters):','Extruder Retraction Speed (mm/s):'],
......@@ -34,28 +34,28 @@ class SkeinforgeQuickEditDialog(wx.Dialog):
'raft':['First Layer Main Feedrate (mm/s):','First Layer Perimeter Feedrate (mm/s):','First Layer Flow Rate Infill(scaler):','First Layer Flow Rate Perimeter(scaler):',],
'speed':['Main Feed Rate (mm/s):','Main Flow Rate (scaler):','Perimeter Feed Rate (mm/s):','Perimeter Flow Rate (scaler):','Travel Feed Rate (mm/s):']
}
self.scrollbarPanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
self.scrollbarPanel = wx.ScrolledWindow(self, -1, style = wx.TAB_TRAVERSAL)
self.settingsSizer = self.getProfileSettings()
self.scrollbarPanel.SetSizer(self.settingsSizer)
self.__set_properties()
self.__do_layout()
self.__set_properties()
self.__do_layout()
self.Show()
def __set_properties(self):
self.profileName = skeinforge_profile.getProfileName(skeinforge_profile.getCraftTypeName())
self.SetTitle("Skeinforge Quick Edit Profile: " + self.profileName)
# For some reason the dialog size is not consistent between Windows and Linux - this is a hack to get it working
# For some reason the dialog size is not consistent between Windows and Linux - this is a hack to get it working
if (os.name == 'nt'):
self.SetMinSize(wx.DLG_SZE(self, (465, 370)))
else:
self.SetSize(wx.DLG_SZE(self, (465, 325)))
self.SetPosition((0, 0))
self.scrollbarPanel.SetScrollRate(10, 10)
def __do_layout(self):
mainSizer = wx.BoxSizer(wx.VERTICAL)
actionsSizer = wx.BoxSizer(wx.HORIZONTAL)
......@@ -65,56 +65,56 @@ class SkeinforgeQuickEditDialog(wx.Dialog):
mainSizer.Add(actionsSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
self.SetSizer(mainSizer)
self.Layout()
def getProfileSettings(self):
settingsSizer = wx.GridBagSizer(hgap=2, vgap=1)
settingsSizer = wx.GridBagSizer(hgap = 2, vgap = 1)
settingsRow = 0
for craftName in sorted(self.moduleSettingsMap.keys()):
craftStaticBox = wx.StaticBox(self.scrollbarPanel, -1, craftName.capitalize())
craftStaticBoxSizer = wx.StaticBoxSizer(craftStaticBox, wx.VERTICAL)
# For some reason the dialog size is not consistent between Windows and Linux - this is a hack to get it working
if (os.name == 'nt'):
craftStaticBoxSizer.SetMinSize((320, -1))
else:
else:
craftStaticBoxSizer.SetMinSize((450, -1))
pluginModule = archive.getModuleWithPath(os.path.join(skeinforge_craft.getPluginsDirectoryPath(), craftName))
repo = pluginModule.getNewRepository()
for setting in settings.getReadRepository(repo).preferences:
if setting.name in self.moduleSettingsMap[craftName]:
settingSizer = wx.GridBagSizer(hgap=2, vgap=2)
settingSizer = wx.GridBagSizer(hgap = 2, vgap = 2)
settingSizer.AddGrowableCol(0)
settingRow = 0
settingLabel = wx.StaticText(self.scrollbarPanel, -1, setting.name)
settingLabel.Wrap(400)
settingSizer.Add(settingLabel, pos=(settingRow, 0))
settingSizer.Add(settingLabel, pos = (settingRow, 0))
if (isinstance(setting.value, bool)):
checkbox = wx.CheckBox(self.scrollbarPanel)
checkbox.SetName(craftName + '.' + setting.name)
checkbox.SetValue(setting.value)
settingSizer.Add(checkbox, pos=(settingRow, 1))
settingSizer.AddSpacer((25, -1), pos=(settingRow, 2))
settingSizer.Add(checkbox, pos = (settingRow, 1))
settingSizer.AddSpacer((25, -1), pos = (settingRow, 2))
else:
textCtrl = wx.TextCtrl(self.scrollbarPanel, value=str(setting.value), size=(50, -1))
textCtrl = wx.TextCtrl(self.scrollbarPanel, value = str(setting.value), size = (50, -1))
textCtrl.SetName(craftName + '.' + setting.name)
settingSizer.Add(textCtrl, pos=(settingRow, 1))
settingSizer.Add(textCtrl, pos = (settingRow, 1))
craftStaticBoxSizer.Add(settingSizer, 1, wx.EXPAND, 0)
settingRow += 1
col = settingsRow % 2
settingsSizer.Add(craftStaticBoxSizer, pos=(settingsRow - col, col))
settingsSizer.Add(craftStaticBoxSizer, pos = (settingsRow - col, col))
settingsRow += 1
return settingsSizer
def OnExit(self, e):
self.Destroy()
def OnSave(self, e):
for x in self.scrollbarPanel.GetChildren():
if (isinstance(x, (wx.CheckBox, wx.TextCtrl))):
......
......@@ -11,9 +11,9 @@ import shutil
class MyFrame(wx.Frame):
def __init__(self, parent, mysize):
wx.Frame.__init__(self, parent, wx.ID_ANY, size=mysize)
wx.Frame.__init__(self, parent, wx.ID_ANY, size = mysize)
self.SetBackgroundColour('black')
# milliseconds per frame
self.delay = 60
# number of loops
......@@ -41,7 +41,7 @@ class MyFrame(wx.Frame):
self.image_list = []
for image_file in file_list:
self.image_list.append(wx.Bitmap(image_file))
# bind the panel to the paint event
wx.EVT_PAINT(self, self.onPaint)
......@@ -49,7 +49,7 @@ class MyFrame(wx.Frame):
if self.mytmpdir:
shutil.rmtree(self.mytmpdir)
def onPaint(self, event=None):
def onPaint(self, event = None):
# this is the wxPython drawing surface/canvas
dc = wx.PaintDC(self)
while self.loops:
......@@ -59,7 +59,7 @@ class MyFrame(wx.Frame):
w, h = bmp.GetSize()
info = "%s %dx%d" % (self.name_list[ix], w, h)
self.SetTitle(info)
#self.SetSize((w,h))
#self.SetSize((w, h))
# draw the image
dc.DrawBitmap(bmp, 0, 0, True)
wx.MilliSleep(self.delay)
......@@ -73,4 +73,4 @@ width = 800
frameoffset = 35
height = 600 + frameoffset
MyFrame(None, (width, height)).Show()
app.MainLoop()
\ No newline at end of file
app.MainLoop()
......@@ -23,9 +23,9 @@ modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
As a special exception, the copyright holders of this library
As a special exception, the copyright holders of this library
hereby recind Section 3 of the GNU Lesser General Public License. This
means that you MAY NOT apply the terms of the ordinary GNU General
means that you MAY NOT apply the terms of the ordinary GNU General
Public License instead of this License to any given copy of the
Library. This has been done to prevent users of the Library from being
denied access or the ability to use future improvements.
......@@ -66,10 +66,10 @@ class BufferedCanvas(wx.Panel):
def __init__(self,
parent,
ID=-1,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.NO_FULL_REPAINT_ON_RESIZE|wx.WANTS_CHARS):
wx.Panel.__init__(self,parent,ID,pos,size,style)
pos = wx.DefaultPosition,
size = wx.DefaultSize,
style = wx.NO_FULL_REPAINT_ON_RESIZE|wx.WANTS_CHARS):
wx.Panel.__init__(self, parent, ID, pos, size, style)
# Bind events
self.Bind(wx.EVT_PAINT, self.onPaint)
......@@ -83,7 +83,7 @@ class BufferedCanvas(wx.Panel):
## General methods
##
def draw(self,dc):
def draw(self, dc):
"""
Stub: called when the canvas needs to be re-drawn.
"""
......@@ -94,9 +94,9 @@ class BufferedCanvas(wx.Panel):
Causes the canvas to be updated.
"""
self.Refresh()
def getWidthHeight(self):
width,height = self.GetClientSizeTuple()
width, height = self.GetClientSizeTuple()
if width == 0:
width = 1
if height == 0:
......
......@@ -2,150 +2,150 @@
#Interactive RepRap e axis calibration program
#(C) Nathan Zadoks 2011
#Licensed under CC-BY-SA or GPLv2 and higher - Pick your poison.
s=300 #Extrusion speed (mm/min)
n=100 #Default length to extrude
m= 0 #User-entered measured extrusion length
k=300 #Default amount of steps per mm
port='/dev/ttyUSB0' #Default serial port to connect to printer
temp=210 #Default extrusion temperature
s = 300 #Extrusion speed (mm/min)
n = 100 #Default length to extrude
m= 0 #User-entered measured extrusion length
k = 300 #Default amount of steps per mm
port='/dev/ttyUSB0' #Default serial port to connect to printer
temp = 210 #Default extrusion temperature
tempmax=250 #Maximum extrusion temperature
tempmax = 250 #Maximum extrusion temperature
t=int(n*60)/s #Time to wait for extrusion
t = int(n*60)/s #Time to wait for extrusion
try:
from printdummy import printcore
from printdummy import printcore
except ImportError:
from printcore import printcore
import time,getopt,sys,os
from printcore import printcore
import time, getopt, sys, os
def float_input(prompt=''):
import sys
f=None
while f==None:
s=raw_input(prompt)
try:
f=float(s)
except ValueError:
sys.stderr.write("Not a valid floating-point number.\n")
sys.stderr.flush()
return f
def wait(t,m=''):
import time,sys
sys.stdout.write(m+'['+(' '*t)+']\r'+m+'[')
sys.stdout.flush()
for i in range(t):
for s in ['|\b','/\b','-\b','\\\b','|']:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(1.0/5)
print
import sys
f = None
while f == None:
s = raw_input(prompt)
try:
f = float(s)
except ValueError:
sys.stderr.write("Not a valid floating-point number.\n")
sys.stderr.flush()
return f
def wait(t, m=''):
import time, sys
sys.stdout.write(m+'['+(' '*t)+']\r'+m+'[')
sys.stdout.flush()
for i in range(t):
for s in ['|\b','/\b','-\b','\\\b','|']:
sys.stdout.write(s)
sys.stdout.flush()
time.sleep(1.0/5)
print
def w(s):
sys.stdout.write(s)
sys.stdout.flush()
sys.stdout.write(s)
sys.stdout.flush()
def heatup(p,temp,s=0):
curtemp=gettemp(p)
p.send_now('M109 S%03d'%temp)
p.temp=0
if not s: w("Heating extruder up..")
f=False
while curtemp<=(temp-1):
p.send_now('M105')
time.sleep(0.5)
if not f:
time.sleep(1.5)
f=True
curtemp=gettemp(p)
if curtemp: w(u"\rHeating extruder up.. %3d \xb0C"%curtemp)
if s: print
else: print "\nReady."
def heatup(p, temp, s = 0):
curtemp = gettemp(p)
p.send_now('M109 S%03d'%temp)
p.temp = 0
if not s: w("Heating extruder up..")
f = False
while curtemp<=(temp-1):
p.send_now('M105')
time.sleep(0.5)
if not f:
time.sleep(1.5)
f = True
curtemp = gettemp(p)
if curtemp: w(u"\rHeating extruder up.. %3d \xb0C"%curtemp)
if s: print
else: print "\nReady."
def gettemp(p):
try: p.logl
except: setattr(p,'logl',0)
try: p.temp
except: setattr(p,'temp',0)
for n in range(p.logl,len(p.log)):
line=p.log[n]
if 'T:' in line:
try:
setattr(p,'temp',int(line.split('T:')[1].split()[0]))
except: print line
p.logl=len(p.log)
return p.temp
try: p.logl
except: setattr(p,'logl',0)
try: p.temp
except: setattr(p,'temp',0)
for n in range(p.logl, len(p.log)):
line = p.log[n]
if 'T:' in line:
try:
setattr(p,'temp',int(line.split('T:')[1].split()[0]))
except: print line
p.logl = len(p.log)
return p.temp
if not os.path.exists(port):
port=0
port = 0
#Parse options
help=u"""
help = u"""
%s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ]
-l --length Length of filament to extrude for each calibration step (default: %d mm)
-s --steps Initial amount of steps to use (default: %d steps)
-t --temp Extrusion temperature in degrees Celsius (default: %d \xb0C, max %d \xb0C)
-p --port Serial port the printer is connected to (default: %s)
-h --help This cruft.
"""[1:-1].encode('utf-8')%(sys.argv[0],n,k,temp,tempmax,port if port else 'auto')
-l --length Length of filament to extrude for each calibration step (default: %d mm)
-s --steps Initial amount of steps to use (default: %d steps)
-t --temp Extrusion temperature in degrees Celsius (default: %d \xb0C, max %d \xb0C)
-p --port Serial port the printer is connected to (default: %s)
-h --help This cruft.
"""[1:-1].encode('utf-8')%(sys.argv[0], n, k, temp, tempmax, port if port else 'auto')
try:
opts,args=getopt.getopt(sys.argv[1:],"hl:s:t:p:",["help","length=","steps=","temp=","port="])
except getopt.GetoptError,err:
print str(err)
print help
sys.exit(2)
for o,a in opts:
if o in ('-h','--help'):
print help
sys.exit()
elif o in ('-l','--length'):
n=float(a)
elif o in ('-s','--steps'):
k=int(a)
elif o in ('-t','--temp'):
temp=int(a)
if temp>=tempmax:
print (u'%d \xb0C? Are you insane?'.encode('utf-8')%temp)+(" That's over nine thousand!" if temp>9000 else '')
sys.exit(255)
elif o in ('-p','--port'):
port=a
opts, args = getopt.getopt(sys.argv[1:],"hl:s:t:p:",["help", "length=", "steps=", "temp=", "port="])
except getopt.GetoptError, err:
print str(err)
print help
sys.exit(2)
for o, a in opts:
if o in ('-h','--help'):
print help
sys.exit()
elif o in ('-l','--length'):
n = float(a)
elif o in ('-s','--steps'):
k = int(a)
elif o in ('-t','--temp'):
temp = int(a)
if temp>=tempmax:
print (u'%d \xb0C? Are you insane?'.encode('utf-8')%temp)+(" That's over nine thousand!" if temp>9000 else '')
sys.exit(255)
elif o in ('-p','--port'):
port = a
#Show initial parameters
print "Initial parameters"
print "Steps per mm: %3d steps"%k
print "Length extruded: %3d mm"%n
print
print
print "Serial port: %s"%(port if port else 'auto')
p=None
p = None
try:
#Connect to printer
w("Connecting to printer..")
try:
p=printcore(port,115200)
except:
print 'Error.'
raise
while not p.online:
time.sleep(1)
w('.')
print " connected."
heatup(p,temp)
#Calibration loop
while n!=m:
heatup(p,temp,True)
p.send_now("G92 E0") #Reset e axis
p.send_now("G1 E%d F%d"%(n,s)) #Extrude length of filament
wait(t,'Extruding.. ')
m=float_input("How many millimeters of filament were extruded? ")
if m==0: continue
if n!=m:
k=(n/m)*k
p.send_now("M92 E%d"%int(round(k))) #Set new step count
print "Steps per mm: %3d steps"%k #Tell user
print 'Calibration completed.' #Yay!
#Connect to printer
w("Connecting to printer..")
try:
p = printcore(port, 115200)
except:
print 'Error.'
raise
while not p.online:
time.sleep(1)
w('.')
print " connected."
heatup(p, temp)
#Calibration loop
while n!=m:
heatup(p, temp, True)
p.send_now("G92 E0") #Reset e axis
p.send_now("G1 E%d F%d"%(n, s)) #Extrude length of filament
wait(t,'Extruding.. ')
m = float_input("How many millimeters of filament were extruded? ")
if m == 0: continue
if n!=m:
k = (n/m)*k
p.send_now("M92 E%d"%int(round(k))) #Set new step count
print "Steps per mm: %3d steps"%k #Tell user
print 'Calibration completed.' #Yay!
except KeyboardInterrupt:
pass
pass
finally:
if p: p.disconnect()
if p: p.disconnect()
......@@ -19,8 +19,8 @@ import threading
class GLPanel(wx.Panel):
'''A simple class for using OpenGL with wxPython.'''
def __init__(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0):
def __init__(self, parent, id, pos = wx.DefaultPosition,
size = wx.DefaultSize, style = 0):
# Forcing a no full repaint to stop flickering
style = style | wx.NO_FULL_REPAINT_ON_RESIZE
#call super function
......@@ -33,7 +33,7 @@ class GLPanel(wx.Panel):
glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit
# Create the canvas
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.canvas = glcanvas.GLCanvas(self, attribList=attribList)
self.canvas = glcanvas.GLCanvas(self, attribList = attribList)
self.sizer.Add(self.canvas, 1, wx.EXPAND)
self.SetSizer(self.sizer)
#self.sizer.Fit(self)
......@@ -200,7 +200,7 @@ def _dist(dist):
class gcpoint(object):
"""gcode point
stub for first line"""
def __init__(self, x=0,y=0,z=0,e=0):
def __init__(self, x = 0, y = 0, z = 0, e = 0):
self.x = x
self.y = y
self.z = z
......@@ -210,10 +210,10 @@ class gcpoint(object):
class gcline(object):
"""gcode move line
Once initialised,it knows its position, length and extrusion ratio
Once initialised, it knows its position, length and extrusion ratio
Returns lines into gcview batch()
"""
def __init__(self, x=None, y=None, z=None, e=None, f=None, prev_gcline=None, orgline = False):
def __init__(self, x = None, y = None, z = None, e = None, f = None, prev_gcline = None, orgline = False):
if prev_gcline is None:
self.prev_gcline = gcpoint()
else:
......@@ -255,7 +255,7 @@ class gcline(object):
self.orgline,
)
def calc_delta(self, prev_gcline=None):
def calc_delta(self, prev_gcline = None):
if prev_gcline is None:
prev_gcline = self.prev_gcline
if self.prev_gcline is not None:
......@@ -290,7 +290,7 @@ class gcline(object):
]
def glcolor(self, upper_limit = None, lower_limit = 0, max_feedrate = 0):
if self.extrusion_ratio == 0:
return [255,255,255,0,0,0]
return [255, 255, 255, 0, 0, 0]
else:
blue_color = 0
green_color = 0
......@@ -312,7 +312,7 @@ class gcline(object):
blue_color = 255
if blue_color < 0:
blue_color = 0
return[255,green_color,blue_color,128,green_color,blue_color/4]
return[255, green_color, blue_color, 128, green_color, blue_color/4]
def float_from_line(axe, line):
......@@ -340,7 +340,7 @@ class gcview(object):
"""gcode visualiser
Holds opengl objects for all layers
"""
def __init__(self, lines, batch, w=0.5, h=0.5):
def __init__(self, lines, batch, w = 0.5, h = 0.5):
if len(lines) == 0:
return
print "Loading %s lines" % (len(lines))
......@@ -430,7 +430,7 @@ class gcview(object):
else:
self.lastf = cur[4]
r = gcline(x=cur[0], y=cur[1], z=cur[2],e=cur[3], f=cur[4], prev_gcline=self.prev, orgline=orgline)
r = gcline(x = cur[0], y = cur[1], z = cur[2], e = cur[3], f = cur[4], prev_gcline = self.prev, orgline = orgline)
self.prev = r
return r
return None
......@@ -524,7 +524,7 @@ def mulquat(q1, rq):
class TestGlPanel(GLPanel):
def __init__(self, parent, size, id=wx.ID_ANY):
def __init__(self, parent, size, id = wx.ID_ANY):
super(TestGlPanel, self).__init__(parent, id, wx.DefaultPosition, size, 0)
self.batches = []
self.rot = 0
......@@ -553,7 +553,7 @@ class TestGlPanel(GLPanel):
def forceresize(self):
self.SetClientSize((self.GetClientSize()[0], self.GetClientSize()[1] + 1))
self.SetClientSize((self.GetClientSize()[0], self.GetClientSize()[1] - 1))
threading.Thread(target=self.update).start()
threading.Thread(target = self.update).start()
self.initialized = 0
def move_shape(self, delta):
......@@ -605,7 +605,7 @@ class TestGlPanel(GLPanel):
p1y = -(float(p1[1]) - sz[1] / 2) / (sz[1] / 2)
p2x = (float(p2[0]) - sz[0] / 2) / (sz[0] / 2)
p2y = -(float(p2[1]) - sz[1] / 2) / (sz[1] / 2)
#print p1x,p1y,p2x,p2y
#print p1x, p1y, p2x, p2y
quat = trackball(p1x, p1y, p2x, p2y, -self.transv[2] / 250.0)
if self.rot:
self.basequat = mulquat(self.basequat, quat)
......@@ -768,7 +768,7 @@ class TestGlPanel(GLPanel):
def drawmodel(self, m, n):
batch = pyglet.graphics.Batch()
stl = stlview(m.facets, batch=batch)
stl = stlview(m.facets, batch = batch)
m.batch = batch
m.animoffset = 300
#print m
......@@ -907,8 +907,8 @@ class TestGlPanel(GLPanel):
class GCFrame(wx.Frame):
'''A simple class for using OpenGL with wxPython.'''
def __init__(self, parent, ID, title, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
def __init__(self, parent, ID, title, pos = wx.DefaultPosition,
size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE):
super(GCFrame, self).__init__(parent, ID, title, pos, (size[0] + 150, size[1]), style)
class d:
......@@ -921,22 +921,22 @@ class GCFrame(wx.Frame):
m.curlayer = -1
m.scale = [1.0, 1.0, 1.0]
m.batch = pyglet.graphics.Batch()
m.gc = gcview([], batch=m.batch)
m.gc = gcview([], batch = m.batch)
self.models = {"GCODE": m}
self.l = d()
self.modelindex = 0
self.GLPanel1 = TestGlPanel(self, size)
def addfile(self, gcode=[]):
def addfile(self, gcode = []):
self.models["GCODE"].gc.delete()
self.models["GCODE"].gc = gcview(gcode, batch=self.models["GCODE"].batch)
self.models["GCODE"].gc = gcview(gcode, batch = self.models["GCODE"].batch)
self.setlayerindex(None)
def clear(self):
self.models["GCODE"].gc.delete()
self.models["GCODE"].gc = gcview([], batch=self.models["GCODE"].batch)
self.models["GCODE"].gc = gcview([], batch = self.models["GCODE"].batch)
def Show(self, arg=True):
def Show(self, arg = True):
wx.Frame.Show(self, arg)
self.SetClientSize((self.GetClientSize()[0], self.GetClientSize()[1] + 1))
self.SetClientSize((self.GetClientSize()[0], self.GetClientSize()[1] - 1))
......@@ -975,8 +975,8 @@ class GCFrame(wx.Frame):
def main():
app = wx.App(redirect=False)
frame = GCFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size=(400, 400))
app = wx.App(redirect = False)
frame = GCFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (400, 400))
import sys
for filename in sys.argv:
if ".gcode" in filename:
......@@ -985,8 +985,8 @@ def main():
#TODO: add stl here
pass
#frame = wx.Frame(None, -1, "GL Window", size=(400, 400))
#panel = TestGlPanel(frame, size=(300,300))
#frame = wx.Frame(None, -1, "GL Window", size = (400, 400))
#panel = TestGlPanel(frame, size = (300, 300))
frame.Show(True)
app.MainLoop()
app.Destroy()
......
......@@ -22,8 +22,8 @@ from bufferedcanvas import *
class Graph(BufferedCanvas):
'''A class to show a Graph with Pronterface.'''
def __init__(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0):
def __init__(self, parent, id, pos = wx.DefaultPosition,
size = wx.DefaultSize, style = 0):
# Forcing a no full repaint to stop flickering
style = style | wx.NO_FULL_REPAINT_ON_RESIZE
#call super function
......@@ -53,7 +53,7 @@ class Graph(BufferedCanvas):
#self.sizer = wx.BoxSizer(wx.HORIZONTAL)
#self.sizer.Add(wx.Button(self, -1, "Button1", (0,0)))
#self.sizer.Add(wx.Button(self, -1, "Button1", (0, 0)))
#self.SetSizer(self.sizer)
......@@ -78,23 +78,23 @@ class Graph(BufferedCanvas):
def drawgrid(self, dc, gc):
#cold,medium,hot = wx.Colour(0,167,223),wx.Colour(239,233,119),wx.Colour(210,50.100)
#col1 = wx.Colour(255,0,0, 255)
#col2 = wx.Colour(255,255,255, 128)
#cold, medium, hot = wx.Colour(0, 167, 223), wx.Colour(239, 233, 119), wx.Colour(210, 50.100)
#col1 = wx.Colour(255, 0, 0, 255)
#col2 = wx.Colour(255, 255, 255, 128)
#b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
gc.SetPen(wx.Pen(wx.Colour(255,0,0,0), 4))
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(245,245,255,252))))
gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 4))
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(245, 245, 255, 252))))
#gc.SetBrush(b)
gc.DrawRectangle(0, 0, self.width, self.height)
#gc.SetBrush(wx.Brush(wx.Colour(245,245,255,52)))
#gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0,0,0,255))))
#gc.SetPen(wx.Pen(wx.Colour(255,0,0,0), 4))
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 255))))
#gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 4))
#gc.DrawLines(wx.Point(0,0), wx.Point(50,10))
#gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10))
#path = gc.CreatePath()
#path.MoveToPoint(0.0, 0.0)
......@@ -107,34 +107,34 @@ class Graph(BufferedCanvas):
font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
gc.SetFont(font, wx.Colour(23,44,44))
gc.SetFont(font, wx.Colour(23, 44, 44))
dc.SetPen(wx.Pen(wx.Colour(225,225,225), 1))
dc.SetPen(wx.Pen(wx.Colour(225, 225, 225), 1))
for x in range(self.xbars):
dc.DrawLine(x*(float(self.width)/self.xbars), 0, x*(float(self.width)/self.xbars), self.height)
dc.SetPen(wx.Pen(wx.Colour(225,225,225), 1))
dc.SetPen(wx.Pen(wx.Colour(225, 225, 225), 1))
for y in range(self.ybars):
y_pos = y*(float(self.height)/self.ybars)
dc.DrawLine(0,y_pos, self.width,y_pos)
dc.DrawLine(0, y_pos, self.width, y_pos)
gc.DrawText(unicode(int(self.maxyvalue - (y * (self.maxyvalue/self.ybars)))), 1, y_pos - (font.GetPointSize() / 2))
if self.timer.IsRunning() == False:
font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD)
gc.SetFont(font, wx.Colour(3,4,4))
gc.SetFont(font, wx.Colour(3, 4, 4))
gc.DrawText("Graph offline", self.width/2 - (font.GetPointSize() * 3), self.height/2 - (font.GetPointSize() * 1))
#dc.DrawCircle(50,50, 1)
#dc.DrawCircle(50, 50, 1)
#gc.SetPen(wx.Pen(wx.Colour(255,0,0,0), 1))
#gc.DrawLines([[20,30], [10,53]])
#dc.SetPen(wx.Pen(wx.Colour(255,0,0,0), 1))
#gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
#gc.DrawLines([[20, 30], [10, 53]])
#dc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
def drawtemperature(self, dc, gc, temperature_list, text, text_xoffset, r, g, b, a):
if self.timer.IsRunning() == False:
dc.SetPen(wx.Pen(wx.Colour(128,128,128,128), 1))
dc.SetPen(wx.Pen(wx.Colour(128, 128, 128, 128), 1))
else:
dc.SetPen(wx.Pen(wx.Colour(r,g,b,a), 1))
dc.SetPen(wx.Pen(wx.Colour(r, g, b, a), 1))
x_add = float(self.width)/self.xsteps
x_pos = float(0.0)
......@@ -143,7 +143,7 @@ class Graph(BufferedCanvas):
for temperature in (temperature_list):
y_pos = int((float(self.height-self.y_offset)/self.maxyvalue)*temperature) + self.y_offset
if (x_pos > 0.0): # One need 2 points to draw a line.
dc.DrawLine(lastxvalue,self.height-self._lastyvalue, x_pos, self.height-y_pos)
dc.DrawLine(lastxvalue, self.height-self._lastyvalue, x_pos, self.height-y_pos)
lastxvalue = x_pos
x_pos = float(x_pos) + x_add
......@@ -153,9 +153,9 @@ class Graph(BufferedCanvas):
font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD)
#font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
if self.timer.IsRunning() == False:
gc.SetFont(font, wx.Colour(128,128,128))
gc.SetFont(font, wx.Colour(128, 128, 128))
else:
gc.SetFont(font, wx.Colour(r,g,b))
gc.SetFont(font, wx.Colour(r, g, b))
#gc.DrawText(text, self.width - (font.GetPointSize() * ((len(text) * text_xoffset + 1))), self.height - self._lastyvalue - (font.GetPointSize() / 2))
gc.DrawText(text, x_pos - x_add - (font.GetPointSize() * ((len(text) * text_xoffset + 1))), self.height - self._lastyvalue - (font.GetPointSize() / 2))
......@@ -163,24 +163,24 @@ class Graph(BufferedCanvas):
def drawbedtemp(self, dc, gc):
self.drawtemperature(dc, gc, self.bedtemps, "Bed",2, 255,0,0, 128)
self.drawtemperature(dc, gc, self.bedtemps, "Bed", 2, 255, 0, 0, 128)
def drawbedtargettemp(self, dc, gc):
self.drawtemperature(dc, gc, self.bedtargettemps, "Bed Target",2, 255,120,0, 128)
self.drawtemperature(dc, gc, self.bedtargettemps, "Bed Target", 2, 255, 120, 0, 128)
def drawextruder0temp(self, dc, gc):
self.drawtemperature(dc, gc, self.extruder0temps, "Ex0",1, 0,155,255, 128)
self.drawtemperature(dc, gc, self.extruder0temps, "Ex0", 1, 0, 155, 255, 128)
def drawextruder0targettemp(self, dc, gc):
self.drawtemperature(dc, gc, self.extruder0targettemps, "Ex0 Target",2, 0,5,255, 128)
self.drawtemperature(dc, gc, self.extruder0targettemps, "Ex0 Target", 2, 0, 5, 255, 128)
def drawextruder1temp(self, dc, gc):
self.drawtemperature(dc, gc, self.extruder1temps, "Ex1",3, 55,55,0, 128)
self.drawtemperature(dc, gc, self.extruder1temps, "Ex1", 3, 55, 55, 0, 128)
def drawextruder1targettemp(self, dc, gc):
self.drawtemperature(dc, gc, self.extruder1targettemps, "Ex1 Target",2, 55,55,0, 128)
self.drawtemperature(dc, gc, self.extruder1targettemps, "Ex1 Target", 2, 55, 55, 0, 128)
def SetBedTemperature(self, value):
......@@ -263,5 +263,3 @@ class Graph(BufferedCanvas):
self.drawextruder0temp(dc, gc)
self.drawextruder1targettemp(dc, gc)
self.drawextruder1temp(dc, gc)
This diff is collapsed.
import os
import gettext
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not found (windows)
def install_locale(domain):
if os.path.exists('/usr/share/pronterface/locale'):
gettext.install(domain, '/usr/share/pronterface/locale', unicode=1)
gettext.install(domain, '/usr/share/pronterface/locale', unicode = 1)
elif os.path.exists('/usr/local/share/pronterface/locale'):
gettext.install(domain, '/usr/local/share/pronterface/locale', unicode=1)
else:
gettext.install(domain, './locale', unicode=1)
gettext.install(domain, '/usr/local/share/pronterface/locale', unicode = 1)
else:
gettext.install(domain, './locale', unicode = 1)
def imagefile(filename):
for prefix in ['/usr/local/share/pronterface/images', '/usr/share/pronterface/images']:
candidate = os.path.join(prefix, filename)
if os.path.exists(candidate):
return candidate
candidate = os.path.join(prefix, filename)
if os.path.exists(candidate):
return candidate
local_candidate = os.path.join(os.path.dirname(__file__), "images", filename)
if os.path.exists(local_candidate):
return local_candidate
......@@ -22,9 +24,9 @@ def imagefile(filename):
def lookup_file(filename, prefixes):
for prefix in prefixes:
candidate = os.path.join(prefix, filename)
if os.path.exists(candidate):
return candidate
candidate = os.path.join(prefix, filename)
if os.path.exists(candidate):
return candidate
return filename
def pixmapfile(filename):
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,4 +3,4 @@
from pyparsing import Literal, Combine
from .identifier import identifier
atkeyword = Combine(Literal("@") + identifier)
\ No newline at end of file
atkeyword = Combine(Literal("@") + identifier)
......@@ -5,4 +5,3 @@
from pyparsing import nestedExpr
block = nestedExpr(opener="{", closer="}")
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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