From 0ecc9d135126cf93572c4dc0b19cbef852fab55c Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 22 Aug 2013 12:02:34 +0200 Subject: [PATCH] Remove the start/end code tab for UltiGCode flavor. --- Cura/gui/app.py | 7 ++++--- Cura/gui/mainWindow.py | 10 +++++++--- Cura/gui/sceneView.py | 2 +- Cura/gui/util/openglGui.py | 36 ++++++++++++++++++++---------------- Cura/util/machineCom.py | 4 ++-- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Cura/gui/app.py b/Cura/gui/app.py index c250d510..f3c8b90e 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -11,12 +11,13 @@ import warnings #Only import the _core to save import time import wx._core + class CuraApp(wx.App): def __init__(self, files): if platform.system() == "Windows" and not 'PYCHARM_HOSTED' in os.environ: - super(CuraApp, self).__init__(redirect = True, filename = 'output.txt') + super(CuraApp, self).__init__(redirect=True, filename='output.txt') else: - super(CuraApp, self).__init__(redirect = False) + super(CuraApp, self).__init__(redirect=False) self.mainWindow = None self.splash = None @@ -100,7 +101,7 @@ if platform.system() == "Darwin": def setFullScreenCapable(frame): frameobj = _objc.PyObjCObject_New(frame.GetHandle(), 0, 1) - NSWindowCollectionBehaviorFullScreenPrimary = 1<<7 + NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7 window = frameobj.window() newBehavior = window.collectionBehavior() | NSWindowCollectionBehaviorFullScreenPrimary window.setCollectionBehavior_(newBehavior) diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 9671c6ac..ad23c3c6 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -489,8 +489,11 @@ class normalSettingsPanel(configBase.configPanelBase): self.pluginPanel.Show(False) #Alteration page - self.alterationPanel = alterationPanel.alterationPanel(self.nb, callback) - self.nb.AddPage(self.alterationPanel, "Start/End-GCode") + if profile.getPreference('gcode_flavor') == 'UltiGCode': + self.alterationPanel = None + else: + self.alterationPanel = alterationPanel.alterationPanel(self.nb, callback) + self.nb.AddPage(self.alterationPanel, "Start/End-GCode") self.Bind(wx.EVT_SIZE, self.OnSize) @@ -576,5 +579,6 @@ class normalSettingsPanel(configBase.configPanelBase): def updateProfileToControls(self): super(normalSettingsPanel, self).updateProfileToControls() - self.alterationPanel.updateProfileToControls() + if self.alterationPanel is not None: + self.alterationPanel.updateProfileToControls() self.pluginPanel.updateProfileToControls() diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index ace09257..62a6da2a 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -104,7 +104,7 @@ class SceneView(openglGui.glGuiPanel): self.viewSelection = openglGui.glComboButton(self, 'View mode', [7,19,11,15,23], ['Normal', 'Overhang', 'Transparent', 'X-Ray', 'Layers'], (-1,0), self.OnViewChange) self.layerSelect = openglGui.glSlider(self, 10000, 0, 1, (-1,-2), lambda : self.QueueRefresh()) - self.youMagineButton = openglGui.glButton(self, 26, 'YouMagine', (2,0), lambda button: youmagineGui.youmagineManager(self.GetTopLevelParent(), self)) + self.youMagineButton = openglGui.glButton(self, 26, 'YouMagine upload', (2,0), lambda button: youmagineGui.youmagineManager(self.GetTopLevelParent(), self)) self.notification = openglGui.glNotification(self, (0, 0)) diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 4799cc3f..abbcf198 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -500,22 +500,26 @@ class glButton(glGuiControl): elif len(self._altTooltip) > 0: glPushMatrix() glTranslatef(pos[0], pos[1], 0) - glTranslatef(0.6*bs*scale, 0, 0) - - glPushMatrix() - glColor4ub(60,60,60,255) - glTranslatef(-1, -1, 0) - opengl.glDrawStringLeft(self._altTooltip) - glTranslatef(0, 2, 0) - opengl.glDrawStringLeft(self._altTooltip) - glTranslatef(2, 0, 0) - opengl.glDrawStringLeft(self._altTooltip) - glTranslatef(0, -2, 0) - opengl.glDrawStringLeft(self._altTooltip) - glPopMatrix() - - glColor4ub(255,255,255,255) - opengl.glDrawStringLeft(self._altTooltip) + glTranslatef(0, 0.6*bs, 0) + glTranslatef(0, 6, 0) + #glTranslatef(0.6*bs*scale, 0, 0) + + for line in self._altTooltip.split('\n'): + glPushMatrix() + glColor4ub(60,60,60,255) + glTranslatef(-1, -1, 0) + opengl.glDrawStringCenter(line) + glTranslatef(0, 2, 0) + opengl.glDrawStringCenter(line) + glTranslatef(2, 0, 0) + opengl.glDrawStringCenter(line) + glTranslatef(0, -2, 0) + opengl.glDrawStringCenter(line) + glPopMatrix() + + glColor4ub(255,255,255,255) + opengl.glDrawStringCenter(line) + glTranslatef(0, 18, 0) glPopMatrix() def _checkHit(self, x, y): diff --git a/Cura/util/machineCom.py b/Cura/util/machineCom.py index 22e6f132..045aed85 100644 --- a/Cura/util/machineCom.py +++ b/Cura/util/machineCom.py @@ -53,10 +53,10 @@ def serialList(forAutoDetect=False): def machineIsConnected(): #UltiGCode is designed for SD-Card printing, so never auto-detect the serial port. - if profile.getPreference('gcode_flavor') == 'UltiGCode': - return False port = profile.getPreference('serial_port') if port == 'AUTO': + if profile.getPreference('gcode_flavor') == 'UltiGCode': + return False return len(serialList(True)) > 0 if platform.system() == "Windows": return port in serialList() -- 2.30.2