Skip to content

Commit

Permalink
UXUI Polishing Part 2.10: open() uni newline, add install_locale
Browse files Browse the repository at this point in the history
  • Loading branch information
neofelis2X committed May 25, 2023
1 parent 6444ca8 commit d1e92a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions printrun/gcodeplater.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_objects(self):
objects = property(get_objects)

def load_file(self, filename):
with open(filename, "r", newline = '') as file:
with open(filename, "r") as file:
gcode = gcoder.GCode(file, get_home_pos(self.build_dimensions))
model = actors.GcodeModel()
if gcode.filament_length > 0:
Expand Down Expand Up @@ -147,7 +147,6 @@ def done(self, event, cb):
# but the end goal is to have a clean per-layer merge
def export_to(self, name):
return self.export_combined(name)
# return self.export_sequential(name)

def export_combined(self, name):
models = list(self.models.values())
Expand Down Expand Up @@ -208,6 +207,10 @@ def add_offset(layer):
logging.info(_("Exported merged G-Codes to %s") % name)

def export_sequential(self, name):
'''
Initial implementation of the gcode exporter,
which prints objects sequentially. No longer used.
'''
models = list(self.models.values())
last_real_position = None
# Sort models by Z max to print smaller objects first
Expand Down
2 changes: 1 addition & 1 deletion printrun/gviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def addgcodehighlight(self, gline):
if __name__ == '__main__':
import sys
app = wx.App(False)
with open(sys.argv[1], "r", newline = '') as arg:
with open(sys.argv[1], "r") as arg:
main = GvizWindow(arg)
main.Show()
app.MainLoop()
7 changes: 5 additions & 2 deletions printrun/projectlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
from collections import OrderedDict
import math
from printrun.gui.widgets import get_space
from .utils import install_locale
install_locale('pronterface')
# Set up Internationalization using gettext

class DisplayFrame(wx.Frame):
def __init__(self, parent, title, res = (1024, 768), printer = None, scale = 1.0, offset = (0, 0)):
Expand Down Expand Up @@ -644,9 +647,9 @@ def load_file(self, event):
layerHeight = float(self.thickness.GetValue())
else:
layers = self.parse_svg(name)
layerHeight = float(f"{layers[1]:.3f}")
layerHeight = round(layers[1], 3)
self.thickness.SetValue(str(layerHeight))
self.statusbar.SetLabel(_("Layer thickness detected: {0:.2f} mm").format(layerHeight))
self.statusbar.SetLabel(_("Layer thickness detected: {0} mm").format(layerHeight))
self.statusbar.SetLabel(_("{0} layers found, total height {1:.2f} mm").format(len(layers[0]), layerHeight * len(layers[0])))
self.layers = layers
self.set_total_layers(len(layers[0]))
Expand Down
3 changes: 3 additions & 0 deletions printrun/spoolmanager/spoolmanager_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import wx
from printrun.gui.widgets import get_space
from printrun.utils import install_locale
install_locale('pronterface')
# Set up Internationalization using gettext

class SpoolManagerMainWindow(wx.Frame):
"""
Expand Down

0 comments on commit d1e92a0

Please sign in to comment.