Skip to content

Commit

Permalink
p/spoolmanager: Fix for too long spool names
Browse files Browse the repository at this point in the history
  • Loading branch information
rockstorm101 committed Mar 18, 2018
1 parent f265256 commit 9193014
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions printrun/spoolmanager/spoolmanager_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ def __init__(self, parent, spool_manager):

full_sizer = wx.BoxSizer(wx.VERTICAL)

# Calculate the minimum size needed to properly display the
# extruder information
min_size = self.GetTextExtent(" Remaining filament: 0000000.00")

# Generate a dialog for every extruder
self.extruder_dialog = []
load_button = []
Expand All @@ -226,7 +230,9 @@ def __init__(self, parent, spool_manager):
dialog_sizer = []
for i in range(self.extruders):
# Generate the dialog with the spool information
self.extruder_dialog.append(wx.StaticText(self))
self.extruder_dialog.append(
wx.StaticText(self, style = wx.ST_ELLIPSIZE_END))
self.extruder_dialog[i].SetMinSize(wx.Size(min_size.width, -1))

# Generate the "load" and "unload" buttons
load_button.append(wx.Button(self, label = "Load"))
Expand Down Expand Up @@ -265,12 +271,12 @@ def refreshDialog(self, spool_manager):
"""Retrieve the current spools from the Spool Manager."""

for i in range(self.extruders):
self.extruder_dialog[i].SetLabel(
"Spool for Extruder %d:\n" % i +
" Name: %s\n" %
spool_manager.getSpoolName(i) +
" Remaining filament: %.2f" %
spool_manager.getRemainingFilament(i))
spool_name = spool_manager.getSpoolName(i)
spool_filament = spool_manager.getRemainingFilament(i)
label = ("Spool for Extruder %d:\n" % i +
" Name: %s\n" % spool_name +
" Remaining filament: %.2f" % spool_filament)
self.extruder_dialog[i].SetLabelText(label)


# ---------------------------------------------------------------------------
Expand Down

0 comments on commit 9193014

Please sign in to comment.