Пример #1
0
	def __init__(self, parent, group, bitmapFilenameOn, bitmapFilenameOff,
	             helpText='', id=-1, callback=None, size=(20, 20)):
		self.bitmapOn = wx.Bitmap(getPathForImage(bitmapFilenameOn))
		self.bitmapOff = wx.Bitmap(getPathForImage(bitmapFilenameOff))

		super(RadioButton, self).__init__(parent, id, self.bitmapOff, size=size)

		self.group = group
		group.append(self)
		self.callback = callback
		self.helpText = helpText
		self._value = False

		self.SetBezelWidth(1)
		self.SetUseFocusIndicator(False)

		self.Bind(wx.EVT_BUTTON, self.OnButton)

		self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
		self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

		if len(group) == 1:
			self.SetValue(True)

		parent.AddControl(self)
Пример #2
0
	def __init__(self, parent):
		super(workingIndicatorWindow, self).__init__(parent, title='YouMagine', style=wx.FRAME_TOOL_WINDOW|wx.FRAME_FLOAT_ON_PARENT|wx.FRAME_NO_TASKBAR|wx.CAPTION)
		self._panel = wx.Panel(self)
		self.SetSizer(wx.BoxSizer())
		self.GetSizer().Add(self._panel, 1, wx.EXPAND)

		self._busyBitmaps = [
			wx.Bitmap(getPathForImage('busy-0.png')),
			wx.Bitmap(getPathForImage('busy-1.png')),
			wx.Bitmap(getPathForImage('busy-2.png')),
			wx.Bitmap(getPathForImage('busy-3.png'))
		]

		self._indicatorBitmap = wx.StaticBitmap(self._panel, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
		self._statusText = wx.StaticText(self._panel, -1, '...')
		self._progress = wx.Gauge(self._panel, -1)
		self._progress.SetRange(1000)
		self._progress.SetMinSize((250, 30))

		self._panel._sizer = wx.GridBagSizer(2, 2)
		self._panel.SetSizer(self._panel._sizer)
		self._panel._sizer.Add(self._indicatorBitmap, (0, 0), flag=wx.ALL, border=5)
		self._panel._sizer.Add(self._statusText, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
		self._panel._sizer.Add(self._progress, (1, 0), span=(1,2), flag=wx.EXPAND|wx.ALL, border=5)

		self._busyState = 0
		self._busyTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self._busyUpdate, self._busyTimer)
		self._busyTimer.Start(100)
Пример #3
0
	def __init__(self):
		self._cam = None
		self._cameraList = None
		self._activeId = -1
		self._overlayImage = wx.Bitmap(getPathForImage('cura-overlay.png'))
		self._overlayUltimaker = wx.Bitmap(getPathForImage('ultimaker-overlay.png'))
		self._doTimelapse = False
		self._bitmap = None

		#open the camera and close it to check if we have a camera, then open the camera again when we use it for the
		# first time.
		cameraList = []
		tryNext = True
		self._camId = 0
		while tryNext:
			tryNext = False
			self._openCam()
			if self._cam is not None:
				cameraList.append(self._cam.getdisplayname())
				tryNext = True
				del self._cam
				self._cam = None
				self._camId += 1
		self._camId = 0
		self._activeId = -1
		self._cameraList = cameraList
Пример #4
0
    def __init__(self, parent):
        super(FirstConnectPrinterSigma,self).__init__(parent, _("Printer connection"))
        self.AddText(_('Please connect your printer to the computer. \nOnce you see "Connected" you may proceed to the next step.'))
        self.checkBitmap = wx.Bitmap(resources.getPathForImage('checkmark.png'))
        self.crossBitmap = wx.Bitmap(resources.getPathForImage('cross.png'))
        self.unknownBitmap = wx.Bitmap(resources.getPathForImage('question.png'))

        connectPritner = self.AddButton(_("Connect printer"))
        connectPritner.Bind(wx.EVT_BUTTON, self.OnCheckClick)
        connectPritner.Enable(True)
        self.AddSeperator()
        self.commState = self.AddCheckmark(_("Communication:"), self.unknownBitmap)
        self.unknownBitmap = wx.Bitmap(resources.getPathForImage('question.png'))
        self.infoBox = self.AddInfoBox()
        self.machineState = self.AddText("")
        self.errorLogButton = self.AddButton(_("Show error log"))
        self.errorLogButton.Show(False)
        self.comm = None
        self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton)
        self.AddSeperator()
        self.AddText(_('Press on the following button to know your current \nfirmware version and check whether there are new releases. \nThis might take a few seconds.'))
        getFirstLine = self.AddButton(_("Get firmware version"))
        getFirstLine.Bind(wx.EVT_BUTTON, self.OnGetFirstLine)
        self.AddSeperator()
        self.AddText(_('Sometimes when releasing new firmware updates, it is \nnecessary to update the files of the LCD Display in order \nto get new functionalities and menus.'))
        openSDFiles = self.AddButton(_("Open SD Files"))
        openSDFiles.Bind(wx.EVT_BUTTON, self.OnOpenSDFiles)
        howToOpen = self.AddButton(_("How to Update SD Files"))
        howToOpen.Bind(wx.EVT_BUTTON, self.OnHowToOpen)
        self.AddSeperator()
Пример #5
0
    def __init__(self,
                 parent,
                 profileSetting,
                 bitmapFilenameOn,
                 bitmapFilenameOff,
                 helpText='',
                 id=-1,
                 callback=None,
                 size=(20, 20)):
        self.bitmapOn = wx.Bitmap(getPathForImage(bitmapFilenameOn))
        self.bitmapOff = wx.Bitmap(getPathForImage(bitmapFilenameOff))

        super(ToggleButton, self).__init__(parent,
                                           id,
                                           self.bitmapOff,
                                           size=size)

        self.callback = callback
        self.profileSetting = profileSetting
        self.helpText = helpText

        self.SetBezelWidth(1)
        self.SetUseFocusIndicator(False)

        if self.profileSetting != '':
            self.SetValue(
                profile.getProfileSetting(self.profileSetting) == 'True')
            self.Bind(wx.EVT_BUTTON, self.OnButtonProfile)
        else:
            self.Bind(wx.EVT_BUTTON, self.OnButton)

        self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

        parent.AddControl(self)
Пример #6
0
    def __init__(self):
        self._cam = None
        self._cameraList = None
        self._activeId = -1
        self._overlayImage = wx.Bitmap(getPathForImage('cura-overlay.png'))
        self._overlayUltimaker = wx.Bitmap(
            getPathForImage('ultimaker-overlay.png'))
        self._doTimelapse = False
        self._bitmap = None

        #open the camera and close it to check if we have a camera, then open the camera again when we use it for the
        # first time.
        cameraList = []
        tryNext = True
        self._camId = 0
        while tryNext:
            tryNext = False
            self._openCam()
            if self._cam is not None:
                cameraList.append(self._cam.getdisplayname())
                tryNext = True
                del self._cam
                self._cam = None
                self._camId += 1
        self._camId = 0
        self._activeId = -1
        self._cameraList = cameraList
Пример #7
0
    def __init__(self,
                 parent,
                 group,
                 bitmapFilenameOn,
                 bitmapFilenameOff,
                 helpText='',
                 id=-1,
                 callback=None):
        self.bitmapOn = wx.Bitmap(getPathForImage(bitmapFilenameOn))
        self.bitmapOff = wx.Bitmap(getPathForImage(bitmapFilenameOff))

        super(RadioButton,
              self).__init__(parent,
                             id,
                             self.bitmapOff,
                             size=self.bitmapOn.GetSize() + (4, 4))

        self.group = group
        group.append(self)
        self.callback = callback
        self.helpText = helpText
        self._value = False

        self.SetBezelWidth(1)
        self.SetUseFocusIndicator(False)

        self.Bind(wx.EVT_BUTTON, self.OnButton)

        self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

        if len(group) == 1:
            self.SetValue(True)

        parent.AddControl(self)
Пример #8
0
	def __init__(self):
		self._cam = None
		self._overlayImage = wx.Bitmap(getPathForImage('cura-overlay.png'))
		self._overlayUltimaker = wx.Bitmap(getPathForImage('ultimaker-overlay.png'))
		if cv != None:
			self._cam = highgui.cvCreateCameraCapture(-1)
		elif win32vidcap != None:
			try:
				self._cam = win32vidcap.new_Dev(0, False)
			except:
				pass

		self._doTimelaps = False
		self._bitmap = None
Пример #9
0
    def __init__(self):
        self._cam = None
        self._overlayImage = wx.Bitmap(getPathForImage('cura-overlay.png'))
        self._overlayUltimaker = wx.Bitmap(
            getPathForImage('ultimaker-overlay.png'))
        if cv != None:
            self._cam = highgui.cvCreateCameraCapture(-1)
        elif win32vidcap != None:
            try:
                self._cam = win32vidcap.new_Dev(0, False)
            except:
                pass

        self._doTimelapse = False
        self._bitmap = None
Пример #10
0
	def __init__(self, parent, ym):
		super(getAuthorizationWindow, self).__init__(parent, title='YouMagine')
		self._panel = wx.Panel(self)
		self.SetSizer(wx.BoxSizer())
		self.GetSizer().Add(self._panel, 1, wx.EXPAND)
		self._ym = ym
		self.abort = False

		self._requestButton = wx.Button(self._panel, -1, _("Request authorization from YouMagine"))
		self._authToken = wx.TextCtrl(self._panel, -1, _("Paste token here"))

		self._panel._sizer = wx.GridBagSizer(5, 5)
		self._panel.SetSizer(self._panel._sizer)

		self._panel._sizer.Add(wx.StaticBitmap(self._panel, -1, wx.Bitmap(getPathForImage('youmagine-text.png'))), (0,0), span=(1,4), flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
		self._panel._sizer.Add(wx.StaticText(self._panel, -1, _("To share your designs on YouMagine\nyou need an account on YouMagine.com\nand authorize Cura to access your account.")), (1, 1))
		self._panel._sizer.Add(self._requestButton, (2, 1), flag=wx.ALL)
		self._panel._sizer.Add(wx.StaticText(self._panel, -1, _("This will open a browser window where you can\nauthorize Cura to access your YouMagine account.\nYou can revoke access at any time\nfrom YouMagine.com")), (3, 1), flag=wx.ALL)
		self._panel._sizer.Add(wx.StaticLine(self._panel, -1), (4,0), span=(1,4), flag=wx.EXPAND | wx.ALL)
		self._panel._sizer.Add(self._authToken, (5, 1), flag=wx.EXPAND | wx.ALL)
		self._panel._sizer.Add(wx.StaticLine(self._panel, -1), (6,0), span=(1,4), flag=wx.EXPAND | wx.ALL)

		self.Bind(wx.EVT_BUTTON, self.OnRequestAuthorization, self._requestButton)
		self.Bind(wx.EVT_TEXT, self.OnEnterToken, self._authToken)
		self.Bind(wx.EVT_CLOSE, self.OnClose)

		self.Fit()
		self.Centre()

		self._authToken.SetFocus()
		self._authToken.SelectAll()
Пример #11
0
 def __init__(self, callback):
     self.callback = callback
     bitmap = wx.Bitmap(getPathForImage('splash.png'))
     super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN,
                                        0, None)
     time.sleep(2)
     wx.CallAfter(self.DoCallback)
Пример #12
0
    def __init__(self, parent):
        super(undoCover, self).__init__(parent, _('SD Update Wizard'))

        self.AddText(_('First of all undo the screw holding the LCD Cover.'))

        self.firstBit = wx.Bitmap(resources.getPathForImage('cover1.png'))
        self.AddBitmap(self.firstBit)
Пример #13
0
	def __init__(self, parent, warningMessage):
		super(warningWindow, self).__init__(parent, title=_("Warning"), style = wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT)

		frameicon = wx.Icon(resources.getPathForImage('cura.ico'), wx.BITMAP_TYPE_ICO)
		self.SetIcon(frameicon)

		self.panel = wx.Panel(self, wx.ID_ANY)

		self.warningMessage = wx.StaticText(self.panel, wx.ID_ANY, warningMessage)
		self.restartNowBtn = wx.Button(self.panel, wx.ID_ANY, _('Restart now'))
		self.restartLaterBtn = wx.Button(self.panel, wx.ID_ANY, _('Restart later'))

		topSizer = wx.BoxSizer(wx.VERTICAL)
		warningSizer = wx.BoxSizer(wx.HORIZONTAL)
		restartSizer = wx.BoxSizer(wx.HORIZONTAL)

		warningSizer.Add(self.warningMessage, 0, flag=wx.ALL, border=5)

		restartSizer.Add(self.restartNowBtn, 0, flag=wx.ALL, border=5)
		restartSizer.Add(self.restartLaterBtn, 0, flag=wx.ALL, border=5)

		topSizer.Add(warningSizer, 0, wx.CENTER)
		topSizer.Add(restartSizer, 0, wx.CENTER)


		self.panel.SetSizer(topSizer)
		topSizer.Fit(self)

		self.Bind(wx.EVT_BUTTON, self.OnRestart, self.restartNowBtn)
		self.Bind(wx.EVT_BUTTON, self.OnClose, self.restartLaterBtn)
		wx.EVT_CLOSE(self, self.OnClose)
    def __init__(self, parent):
        super(undoCover, self).__init__(parent, _('SD Update Wizard'))

        self.AddText(_('First of all undo the screw holding the LCD Cover.'))

        self.firstBit = wx.Bitmap(resources.getPathForImage('cover1.png'))
        self.AddBitmap(self.firstBit)
Пример #15
0
	def __init__(self, callback):
		self.callback = callback
		bitmap = wx.Bitmap(getPathForImage('splash.png'))
		super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 100, None)
		# Add a timeout and call the callback in the close event to avoid having the callback called
		# before the splashscreen paint events which could cause it not to appear or to appear as a grey
		# rectangle while the app is loading
		self.Bind(wx.EVT_CLOSE, self.OnClose)
Пример #16
0
	def __init__(self, parent, logText):
		super(LogWindow, self).__init__(parent, title=_("Log"))
		frameicon = wx.Icon(resources.getPathForImage('cura.ico'), wx.BITMAP_TYPE_ICO)
		self.SetIcon(frameicon)
		self.textBox = wx.TextCtrl(self, -1, unicode(logText, errors='ignore'), style=wx.TE_MULTILINE | wx.TE_DONTWRAP | wx.TE_READONLY)
		self.SetSize((500, 400))
		self.Centre()
		self.Show(True)
Пример #17
0
	def __init__(self, callback):
		self.callback = callback
		bitmap = wx.Bitmap(getPathForImage('splash.png'))
		super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 100, None)
		# Add a timeout and call the callback in the close event to avoid having the callback called
		# before the splashscreen paint events which could cause it not to appear or to appear as a grey
		# rectangle while the app is loading
		self.Bind(wx.EVT_CLOSE, self.OnClose)
Пример #18
0
    def __init__(self, parent):
        super(InfoBox, self).__init__(parent)
        self.SetBackgroundColour('#FFFF80')

        self.sizer = wx.GridBagSizer(5, 5)
        self.SetSizer(self.sizer)

        self.attentionBitmap = wx.Bitmap(resources.getPathForImage('attention.png'))
        self.errorBitmap = wx.Bitmap(resources.getPathForImage('error.png'))
        self.readyBitmap = wx.Bitmap(resources.getPathForImage('ready.png'))
        self.busyBitmap = [
            wx.Bitmap(resources.getPathForImage('busy-0.png')),
            wx.Bitmap(resources.getPathForImage('busy-1.png')),
            wx.Bitmap(resources.getPathForImage('busy-2.png')),
            wx.Bitmap(resources.getPathForImage('busy-3.png'))
        ]

        self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
        self.text = wx.StaticText(self, -1, '')
        self.extraInfoButton = wx.Button(self, -1, 'i', style=wx.BU_EXACTFIT)
        self.sizer.Add(self.bitmap, pos=(0, 0), flag=wx.ALL, border=5)
        self.sizer.Add(self.text, pos=(0, 1), flag=wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL, border=5)
        self.sizer.Add(self.extraInfoButton, pos=(0,2), flag=wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border=5)
        self.sizer.AddGrowableCol(1)

        self.extraInfoButton.Show(False)

        self.extraInfoUrl = ''
        self.busyState = None
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.doBusyUpdate, self.timer)
        self.Bind(wx.EVT_BUTTON, self.doExtraInfo, self.extraInfoButton)
        self.timer.Start(100)
Пример #19
0
    def __init__(self, parent):
        super(InfoBox, self).__init__(parent)
        self.SetBackgroundColour('#FFFF80')

        self.sizer = wx.GridBagSizer(5, 5)
        self.SetSizer(self.sizer)

        self.attentionBitmap = wx.Bitmap(resources.getPathForImage('attention.png'))
        self.errorBitmap = wx.Bitmap(resources.getPathForImage('error.png'))
        self.readyBitmap = wx.Bitmap(resources.getPathForImage('ready.png'))
        self.busyBitmap = [
            wx.Bitmap(resources.getPathForImage('busy-0.png')),
            wx.Bitmap(resources.getPathForImage('busy-1.png')),
            wx.Bitmap(resources.getPathForImage('busy-2.png')),
            wx.Bitmap(resources.getPathForImage('busy-3.png'))
        ]

        self.bitmap = wx.StaticBitmap(self, -1, wx.EmptyBitmapRGBA(24, 24, red=255, green=255, blue=255, alpha=1))
        self.text = wx.StaticText(self, -1, '')
        self.extraInfoButton = wx.Button(self, -1, 'i', style=wx.BU_EXACTFIT)
        self.sizer.Add(self.bitmap, pos=(0, 0), flag=wx.ALL, border=5)
        self.sizer.Add(self.text, pos=(0, 1), flag=wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL, border=5)
        self.sizer.Add(self.extraInfoButton, pos=(0,2), flag=wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, border=5)
        self.sizer.AddGrowableCol(1)

        self.extraInfoButton.Show(False)

        self.extraInfoUrl = ''
        self.busyState = None
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.doBusyUpdate, self.timer)
        self.Bind(wx.EVT_BUTTON, self.doExtraInfo, self.extraInfoButton)
        self.timer.Start(100)
Пример #20
0
    def __init__(self, parent, nbForbiddenFiles):
        super(forbiddenWindow, self).__init__(parent,
                                              title=_("Warning"),
                                              style=wx.DEFAULT_DIALOG_STYLE
                                              | wx.FRAME_FLOAT_ON_PARENT)

        frameicon = wx.Icon(resources.getPathForImage('cura.ico'),
                            wx.BITMAP_TYPE_ICO)
        self.SetIcon(frameicon)

        wx.EVT_CLOSE(self, self.OnClose)

        p = wx.Panel(self)
        self.panel = p
        s = wx.BoxSizer()
        self.SetSizer(s)
        s.Add(p)
        s = wx.BoxSizer(wx.VERTICAL)
        p.SetSizer(s)

        self.more_details_url = hl.HyperLinkCtrl(p,
                                                 wx.ID_ANY,
                                                 _("More details..."),
                                                 URL=_("warning_url"))
        #hl.EVT_HYPERLINK_LEFT(self, self.more_details_url.GetId(), self.OnClick)
        self.more_details_url.AutoBrowse(False)
        self.more_details_url.Bind(hl.EVT_HYPERLINK_LEFT, self.OnClick)

        img = wx.Image(resources.getPathForImage('forbidden.png'),
                       wx.BITMAP_TYPE_PNG)
        s.Add(wx.StaticBitmap(p, -1, wx.BitmapFromImage(img)),
              flag=wx.ALIGN_CENTRE | wx.BOTTOM | wx.LEFT | wx.RIGHT,
              border=5)
        s.Add(wx.StaticText(
            p, -1,
            _("Our software doest not allow the printing of 3D weapons.")),
              flag=wx.ALIGN_CENTRE | wx.BOTTOM | wx.LEFT | wx.RIGHT,
              border=5)
        s.Add(wx.StaticLine(p),
              flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
              border=5)
        s.Add(self.more_details_url,
              flag=wx.ALIGN_CENTRE | wx.BOTTOM | wx.LEFT | wx.RIGHT,
              border=5)
        self.Fit()
Пример #21
0
    def __init__(self, parent):
        super(removeSDCard, self).__init__(parent, _('SD Update Wizard'))

        self.AddText(_('Now take out the micro SD card. You just need to push it in and\n'
                       'the SD card will come off. Be careful not to lose the SD card\n'
                       'inside the printer.'))

        self.secondBit = wx.Bitmap(resources.getPathForImage('cover2.png'))
        self.AddBitmap(self.secondBit)
    def __init__(self, parent):
        super(removeSDCard, self).__init__(parent, _('SD Update Wizard'))

        self.AddText(
            _('Now take out the micro SD card. You just need to push it in and\n'
              'the SD card will come off. Be careful not to lose the SD card\n'
              'inside the printer.'))

        self.secondBit = wx.Bitmap(resources.getPathForImage('cover2.png'))
        self.AddBitmap(self.secondBit)
Пример #23
0
    def __init__(self, parent):
        super(UltimakerCheckupPage, self).__init__(parent, "Ultimaker Checkup")

        self.checkBitmap = wx.Bitmap(getPathForImage('checkmark.png'))
        self.crossBitmap = wx.Bitmap(getPathForImage('cross.png'))
        self.unknownBitmap = wx.Bitmap(getPathForImage('question.png'))
        self.endStopNoneBitmap = wx.Bitmap(getPathForImage('endstop_none.png'))
        self.endStopXMinBitmap = wx.Bitmap(getPathForImage('endstop_xmin.png'))
        self.endStopXMaxBitmap = wx.Bitmap(getPathForImage('endstop_xmax.png'))
        self.endStopYMinBitmap = wx.Bitmap(getPathForImage('endstop_ymin.png'))
        self.endStopYMaxBitmap = wx.Bitmap(getPathForImage('endstop_ymax.png'))
        self.endStopZMinBitmap = wx.Bitmap(getPathForImage('endstop_zmin.png'))
        self.endStopZMaxBitmap = wx.Bitmap(getPathForImage('endstop_zmax.png'))

        self.AddText(
            'It is a good idea to do a few sanity checks now on your Ultimaker.\nYou can skip these if you know your machine is functional.'
        )
        b1, b2 = self.AddDualButton('Run checks', 'Skip checks')
        b1.Bind(wx.EVT_BUTTON, self.OnCheckClick)
        b2.Bind(wx.EVT_BUTTON, self.OnSkipClick)
        self.AddSeperator()
        self.commState = self.AddCheckmark('Communication:',
                                           self.unknownBitmap)
        self.tempState = self.AddCheckmark('Temperature:', self.unknownBitmap)
        self.stopState = self.AddCheckmark('Endstops:', self.unknownBitmap)
        self.AddSeperator()
        self.infoBox = self.AddInfoBox()
        self.machineState = self.AddText('')
        self.temperatureLabel = self.AddText('')
        self.errorLogButton = self.AddButton('Show error log')
        self.errorLogButton.Show(False)
        self.AddSeperator()
        self.endstopBitmap = self.AddBitmap(self.endStopNoneBitmap)
        self.comm = None
        self.xMinStop = False
        self.xMaxStop = False
        self.yMinStop = False
        self.yMaxStop = False
        self.zMinStop = False
        self.zMaxStop = False

        self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton)
Пример #24
0
	def __init__(self, parent, commandList, bitmapFilename, size=(20, 20)):
		self.bitmap = wx.Bitmap(getPathForImage(bitmapFilename))
		super(PrintCommandButton, self).__init__(parent.directControlPanel, -1, self.bitmap, size=size)

		self.commandList = commandList
		self.parent = parent

		self.SetBezelWidth(1)
		self.SetUseFocusIndicator(False)

		self.Bind(wx.EVT_BUTTON, self.OnClick)
Пример #25
0
	def __init__(self, parent, commandList, bitmapFilename, size=(20, 20)):
		self.bitmap = wx.Bitmap(getPathForImage(bitmapFilename))
		super(PrintCommandButton, self).__init__(parent.directControlPanel, -1, self.bitmap, size=size)

		self.commandList = commandList
		self.parent = parent

		self.SetBezelWidth(1)
		self.SetUseFocusIndicator(False)

		self.Bind(wx.EVT_BUTTON, self.OnClick)
Пример #26
0
    def __init__(self, parent):
        super(UltimakerCheckupPage, self).__init__(parent, "Ultimaker Checkup")

        self.checkBitmap = wx.Bitmap(getPathForImage("checkmark.png"))
        self.crossBitmap = wx.Bitmap(getPathForImage("cross.png"))
        self.unknownBitmap = wx.Bitmap(getPathForImage("question.png"))
        self.endStopNoneBitmap = wx.Bitmap(getPathForImage("endstop_none.png"))
        self.endStopXMinBitmap = wx.Bitmap(getPathForImage("endstop_xmin.png"))
        self.endStopXMaxBitmap = wx.Bitmap(getPathForImage("endstop_xmax.png"))
        self.endStopYMinBitmap = wx.Bitmap(getPathForImage("endstop_ymin.png"))
        self.endStopYMaxBitmap = wx.Bitmap(getPathForImage("endstop_ymax.png"))
        self.endStopZMinBitmap = wx.Bitmap(getPathForImage("endstop_zmin.png"))
        self.endStopZMaxBitmap = wx.Bitmap(getPathForImage("endstop_zmax.png"))

        self.AddText(
            "It is a good idea to do a few sanity checks now on your Ultimaker.\nYou can skip these if you know your machine is functional."
        )
        b1, b2 = self.AddDualButton("Run checks", "Skip checks")
        b1.Bind(wx.EVT_BUTTON, self.OnCheckClick)
        b2.Bind(wx.EVT_BUTTON, self.OnSkipClick)
        self.AddSeperator()
        self.commState = self.AddCheckmark("Communication:", self.unknownBitmap)
        self.tempState = self.AddCheckmark("Temperature:", self.unknownBitmap)
        self.stopState = self.AddCheckmark("Endstops:", self.unknownBitmap)
        self.AddSeperator()
        self.infoBox = self.AddInfoBox()
        self.machineState = self.AddText("")
        self.temperatureLabel = self.AddText("")
        self.errorLogButton = self.AddButton("Show error log")
        self.errorLogButton.Show(False)
        self.AddSeperator()
        self.endstopBitmap = self.AddBitmap(self.endStopNoneBitmap)
        self.comm = None
        self.xMinStop = False
        self.xMaxStop = False
        self.yMinStop = False
        self.yMaxStop = False
        self.zMinStop = False
        self.zMaxStop = False

        self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton)
Пример #27
0
 def __init__(self, parent, logText):
     super(LogWindow, self).__init__(parent, title=_("Log"))
     frameicon = wx.Icon(resources.getPathForImage('cura.ico'),
                         wx.BITMAP_TYPE_ICO)
     self.SetIcon(frameicon)
     self.textBox = wx.TextCtrl(self,
                                -1,
                                unicode(logText, errors='ignore'),
                                style=wx.TE_MULTILINE | wx.TE_DONTWRAP
                                | wx.TE_READONLY)
     self.SetSize((500, 400))
     self.Centre()
     self.Show(True)
Пример #28
0
    def __init__(self, parent):
        super(FirstConnectPrinterR,self).__init__(parent, _("Printer connection"))
        self.AddText(_('Please connect your printer to the computer. \nOnce you see "Connected" you may proceed to the next step.'))
        self.checkBitmap = wx.Bitmap(resources.getPathForImage('checkmark.png'))
        self.crossBitmap = wx.Bitmap(resources.getPathForImage('cross.png'))
        self.unknownBitmap = wx.Bitmap(resources.getPathForImage('question.png'))

        connectPritner = self.AddButton(_("Connect printer"))
        connectPritner.Bind(wx.EVT_BUTTON, self.OnCheckClick)
        connectPritner.Enable(True)
        self.AddSeperator()
        self.commState = self.AddCheckmark(_("Communication:"), self.unknownBitmap)
        self.unknownBitmap = wx.Bitmap(resources.getPathForImage('question.png'))
        self.infoBox = self.AddInfoBox()
        self.machineState = self.AddText("")
        self.errorLogButton = self.AddButton(_("Show error log"))
        self.errorLogButton.Show(False)
        self.comm = None
        self.Bind(wx.EVT_BUTTON, self.OnErrorLog, self.errorLogButton)
        self.AddSeperator()
        self.AddText(_('Press on the following button to know your current \nfirmware version and check whether there are new releases. \nThis might take a few seconds.'))
        getFirstLine = self.AddButton(_("Get firmware version"))
        getFirstLine.Bind(wx.EVT_BUTTON, self.OnGetFirstLine)
        self.AddSeperator()
Пример #29
0
	def __init__(self, parent, profileSetting, bitmapFilenameOn, bitmapFilenameOff,
	             helpText='', id=-1, callback=None, size=(20, 20)):
		self.bitmapOn = wx.Bitmap(getPathForImage(bitmapFilenameOn))
		self.bitmapOff = wx.Bitmap(getPathForImage(bitmapFilenameOff))

		super(ToggleButton, self).__init__(parent, id, self.bitmapOff, size=size)

		self.callback = callback
		self.profileSetting = profileSetting
		self.helpText = helpText

		self.SetBezelWidth(1)
		self.SetUseFocusIndicator(False)

		if self.profileSetting != '':
			self.SetValue(profile.getProfileSetting(self.profileSetting) == 'True')
			self.Bind(wx.EVT_BUTTON, self.OnButtonProfile)
		else:
			self.Bind(wx.EVT_BUTTON, self.OnButton)

		self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
		self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

		parent.AddControl(self)
Пример #30
0
    def getPrinters(self, isWizard):
        # Build printers array
        printers = resources.getPrinters()
        wxPrinters = []
        firstItem = True
        for printer in printers:
            wx_printer = wxPrinter()
            img = wx.Image(resources.getPathForImage(printer.get('img')),
                           wx.BITMAP_TYPE_ANY)
            wx_printer.image = wx.StaticBitmap(self, -1,
                                               wx.BitmapFromImage(img))

            if firstItem:
                radio = wx.RadioButton(self,
                                       -1,
                                       printer.get('name'),
                                       style=wx.RB_GROUP)
            else:
                radio = wx.RadioButton(self, -1, printer.get('name'))

            if isWizard and firstItem:
                radio.SetValue(True)
                self.name = printer.get('name')
            else:
                if printer.get('name') == self.name:
                    radio.SetValue(True)
                else:
                    radio.SetValue(False)

            def OnPrinterSelect(e, name=printer.get('name')):
                self.name = name

                self.GetParent().optionsPanel.UpdateDisplay(name)

            radio.Bind(wx.EVT_RADIOBUTTON, OnPrinterSelect)
            wx_printer.name = radio

            desc_text = printer.get('desc')
            if desc_text != '':
                desc_text = _(desc_text)
            desc = wx.StaticText(self, -1, desc_text)
            wx_printer.description = desc

            wxPrinters.append(wx_printer)

            firstItem = False

        return wxPrinters
def loadGLTexture(filename):
	tex = glGenTextures(1)
	glBindTexture(GL_TEXTURE_2D, tex)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
	img = wx.ImageFromBitmap(wx.Bitmap(getPathForImage(filename)))
	rgbData = img.GetData()
	alphaData = img.GetAlphaData()
	if alphaData is not None:
		data = ''
		for i in xrange(0, len(alphaData)):
			data += rgbData[i*3:i*3+3] + alphaData[i]
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
	else:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, rgbData)
	return tex
Пример #32
0
def loadGLTexture(filename):
	tex = glGenTextures(1)
	glBindTexture(GL_TEXTURE_2D, tex)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
	img = wx.ImageFromBitmap(wx.Bitmap(getPathForImage(filename)))
	rgbData = img.GetData()
	alphaData = img.GetAlphaData()
	if alphaData is not None:
		data = ''
		for i in xrange(0, len(alphaData)):
			data += rgbData[i*3:i*3+3] + alphaData[i]
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
	else:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, rgbData)
	return tex
Пример #33
0
	def __init__(self, parent, callback, bitmapFilename,
	             helpText='', id=-1, size=(20, 20)):
		self.bitmap = wx.Bitmap(getPathForImage(bitmapFilename))
		super(NormalButton, self).__init__(parent, id, self.bitmap, size=size)

		self.helpText = helpText
		self.callback = callback

		self.SetBezelWidth(1)
		self.SetUseFocusIndicator(False)

		self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
		self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

		self.Bind(wx.EVT_BUTTON, self.OnButton)

		parent.AddControl(self)
Пример #34
0
	def getPrinters(self, isWizard):
		# Build printers array
		printers = resources.getPrinters()
		wxPrinters = []
		firstItem = True
		for printer in printers:
			wx_printer = wxPrinter()
			img = wx.Image(resources.getPathForImage(printer.get('img')), wx.BITMAP_TYPE_ANY)
			wx_printer.image = wx.StaticBitmap(self, -1, wx.BitmapFromImage(img))

			if firstItem:
				radio = wx.RadioButton(self, -1, printer.get('name'), style=wx.RB_GROUP)
			else:
				radio = wx.RadioButton(self, -1, printer.get('name'))

			if isWizard and firstItem:
				radio.SetValue(True)
				self.name = printer.get('name')
			else:
				if printer.get('name') == self.name:
					radio.SetValue(True)
				else:
					radio.SetValue(False)

			def OnPrinterSelect(e, name = printer.get('name')):
				self.name = name

				self.GetParent().optionsPanel.UpdateDisplay(name)

			radio.Bind(wx.EVT_RADIOBUTTON, OnPrinterSelect)
			wx_printer.name = radio

			desc_text = printer.get('desc')
			if desc_text != '':
				desc_text = _(desc_text)
			desc = wx.StaticText(self, -1, desc_text)
			wx_printer.description = desc

			wxPrinters.append(wx_printer)

			firstItem = False

		return wxPrinters
Пример #35
0
	def __init__(self, parent = None, firstTime = True):
		super(ConfigWizard, self).__init__(parent, -1, _("Configuration wizard"))

		self.parent = parent
		if firstTime:
			profile.putPreference('xml_file', 'discovery200.xml')

		frameicon = wx.Icon(resources.getPathForImage('cura.ico'), wx.BITMAP_TYPE_ICO)
		self.SetIcon(frameicon)

		self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged)
		self.Bind(wx.wizard.EVT_WIZARD_FINISHED, self.OnPageFinished)

		self.configurationPage = ConfigurationPage(self, firstTime)

		#self.FitToPage(self.configurationPage)
		self.GetPageAreaSizer().Add(self.configurationPage)
		self.RunWizard(self.configurationPage)
		self.Destroy()
Пример #36
0
	def __init__(self, parent, callback):
		super(TemperatureField, self).__init__(parent)
		self.callback = callback

		self.SetBackgroundColour(wx.WHITE)

		self.text = IntCtrl(self, -1)
		self.text.SetBounds(0, 300)
		self.text.SetSize((60, 28))

		self.unit = wx.StaticBitmap(self, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature-unit.png'))), (0, 0))

		self.button = wx.Button(self, -1, _("Set"))
		self.button.SetSize((35, 25))
		self.Bind(wx.EVT_BUTTON, lambda e: self.callback(self.text.GetValue()), self.button)

		self.text.SetPosition((0, 0))
		self.unit.SetPosition((60, 0))
		self.button.SetPosition((90, 0))
Пример #37
0
	def __init__(self, parent, callback):
		super(TemperatureField, self).__init__(parent)
		self.callback = callback

		self.SetBackgroundColour(wx.WHITE)

		self.text = IntCtrl(self, -1)
		self.text.SetBounds(0, 300)
		self.text.SetSize((60, 28))

		self.unit = wx.StaticBitmap(self, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature-unit.png'))), (0, 0))

		self.button = wx.Button(self, -1, _("Set"))
		self.button.SetSize((35, 25))
		self.Bind(wx.EVT_BUTTON, lambda e: self.callback(self.text.GetValue()), self.button)

		self.text.SetPosition((0, 0))
		self.unit.SetPosition((60, 0))
		self.button.SetPosition((90, 0))
Пример #38
0
    def __init__(self, parent=None, firstTime=True):
        super(ConfigWizard, self).__init__(parent, -1,
                                           _("Configuration wizard"))

        self.parent = parent
        if firstTime:
            profile.putPreference('xml_file', 'discovery200.xml')

        frameicon = wx.Icon(resources.getPathForImage('cura.ico'),
                            wx.BITMAP_TYPE_ICO)
        self.SetIcon(frameicon)

        self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged)
        self.Bind(wx.wizard.EVT_WIZARD_FINISHED, self.OnPageFinished)

        self.configurationPage = ConfigurationPage(self, firstTime)

        #self.FitToPage(self.configurationPage)
        self.GetPageAreaSizer().Add(self.configurationPage)
        self.RunWizard(self.configurationPage)
        self.Destroy()
Пример #39
0
    def __init__(self,
                 parent,
                 callback,
                 bitmapFilename,
                 helpText='',
                 id=-1,
                 size=(20, 20)):
        self.bitmap = wx.Bitmap(getPathForImage(bitmapFilename))
        super(NormalButton, self).__init__(parent, id, self.bitmap, size=size)

        self.helpText = helpText
        self.callback = callback

        self.SetBezelWidth(1)
        self.SetUseFocusIndicator(False)

        self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)

        self.Bind(wx.EVT_BUTTON, self.OnButton)

        parent.AddControl(self)
Пример #40
0
	def __init__(self, parent):
		super(aboutWindow, self).__init__(parent, title=_("About"), style = wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT)

		frameicon = wx.Icon(resources.getPathForImage('cura.ico'), wx.BITMAP_TYPE_ICO)
		self.SetIcon(frameicon)

		isWindows = platform.system() == "Windows"

		wx.EVT_CLOSE(self, self.OnClose)

		p = wx.Panel(self)
		self.panel = p
		s = wx.BoxSizer()
		self.SetSizer(s)
		s.Add(p)
		s = wx.BoxSizer(wx.VERTICAL)
		p.SetSizer(s)

		title = wx.StaticText(p, -1, 'Cura by Dagoma')
		title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
		s.Add(title, flag=wx.ALIGN_CENTRE|wx.BOTTOM|wx.TOP|wx.LEFT|wx.RIGHT, border=5)
		s.Add(wx.StaticText(p, -1, _('Cura by Dagoma was originally forked from Legacy Cura.\nIt is built with the following components:')), flag=wx.BOTTOM|wx.LEFT|wx.RIGHT, border=5)

		self.addComponent('LegacyCura', _('Graphical user interface'), 'AGPLv3', 'https://github.com/daid/LegacyCura')
		self.addComponent('CuraEngine', _('GCode Generator'), 'AGPLv3', 'https://github.com/Ultimaker/CuraEngine')
		self.addComponent('Clipper', _('Polygon clipping library'), 'Boost', 'http://www.angusj.com/delphi/clipper.php')
		self.addComponent('Python 2.7', _('Framework'), 'Python', 'http://python.org/')
		self.addComponent('wxPython', _('GUI Framework'), 'wxWindows', 'http://www.wxpython.org/')
		self.addComponent('PyOpenGL', _('3D Rendering Framework'), 'BSD', 'http://pyopengl.sourceforge.net/')
		self.addComponent('PySerial', _('Serial communication library'), 'Python license', 'http://pyserial.sourceforge.net/')
		self.addComponent('NumPy', _('Support library for faster math'), 'BSD', 'http://www.numpy.org/', isWindows)
		if isWindows:
			self.addComponent('VideoCapture', _('Library for WebCam capture'), 'LGPLv2.1', 'http://videocapture.sourceforge.net/')
			self.addComponent('comtypes', _('Library to help with windows taskbar features'), 'MIT', 'http://starship.python.net/crew/theller/comtypes/')
			self.addComponent('EjectMedia', _('Utility to safe-remove SD cards'), 'Freeware', 'http://www.uwe-sieber.de/english.html', False)
		self.Fit()
Пример #41
0
    def __init__(self, parent, warningMessage):
        super(warningWindow, self).__init__(parent,
                                            title=_("Warning"),
                                            style=wx.DEFAULT_DIALOG_STYLE
                                            | wx.FRAME_FLOAT_ON_PARENT)

        frameicon = wx.Icon(resources.getPathForImage('cura.ico'),
                            wx.BITMAP_TYPE_ICO)
        self.SetIcon(frameicon)

        self.panel = wx.Panel(self, wx.ID_ANY)

        self.warningMessage = wx.StaticText(self.panel, wx.ID_ANY,
                                            warningMessage)
        self.restartNowBtn = wx.Button(self.panel, wx.ID_ANY, _('Restart now'))
        self.restartLaterBtn = wx.Button(self.panel, wx.ID_ANY,
                                         _('Restart later'))

        topSizer = wx.BoxSizer(wx.VERTICAL)
        warningSizer = wx.BoxSizer(wx.HORIZONTAL)
        restartSizer = wx.BoxSizer(wx.HORIZONTAL)

        warningSizer.Add(self.warningMessage, 0, flag=wx.ALL, border=5)

        restartSizer.Add(self.restartNowBtn, 0, flag=wx.ALL, border=5)
        restartSizer.Add(self.restartLaterBtn, 0, flag=wx.ALL, border=5)

        topSizer.Add(warningSizer, 0, wx.CENTER)
        topSizer.Add(restartSizer, 0, wx.CENTER)

        self.panel.SetSizer(topSizer)
        topSizer.Fit(self)

        self.Bind(wx.EVT_BUTTON, self.OnRestart, self.restartNowBtn)
        self.Bind(wx.EVT_BUTTON, self.OnClose, self.restartLaterBtn)
        wx.EVT_CLOSE(self, self.OnClose)
Пример #42
0
	def __init__(self, parent, printerConnection):
		super(printWindowAdvanced, self).__init__(parent, -1, style=wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.CAPTION|wx.SYSTEM_MENU|wx.FRAME_FLOAT_ON_PARENT|wx.MINIMIZE_BOX, title=_("Printing on %s") % (printerConnection.getName()))
		self._printerConnection = printerConnection
		self._lastUpdateTime = time.time()
		self._printDuration = 0
		self._lastDurationTime = None
		self._isPrinting = False

		self.SetSizer(wx.BoxSizer(wx.VERTICAL))
		self.toppanel = wx.Panel(self)
		self.topsizer = wx.GridBagSizer(2, 2)
		self.toppanel.SetSizer(self.topsizer)
		self.toppanel.SetBackgroundColour(wx.WHITE)
		self.topsizer.SetEmptyCellSize((125, 1))
		self.panel = wx.Panel(self)
		self.sizer = wx.GridBagSizer(2, 2)
		self.sizer.SetEmptyCellSize((125, 1))
		self.panel.SetSizer(self.sizer)
		self.panel.SetBackgroundColour(wx.WHITE)
		self.GetSizer().Add(self.toppanel, 0, flag=wx.EXPAND)
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)

		self._fullscreenTemperature = None
		self._termHistory = []
		self._termHistoryIdx = 0

		self._mapImage = wx.Image(resources.getPathForImage('print-window-map.png'))
		self._colorCommandMap = {}

		# Move X
		self._addMovementCommand(0, 0, 255, self._moveX, 100)
		self._addMovementCommand(0, 0, 240, self._moveX, 10)
		self._addMovementCommand(0, 0, 220, self._moveX, 1)
		self._addMovementCommand(0, 0, 200, self._moveX, 0.1)
		self._addMovementCommand(0, 0, 180, self._moveX, -0.1)
		self._addMovementCommand(0, 0, 160, self._moveX, -1)
		self._addMovementCommand(0, 0, 140, self._moveX, -10)
		self._addMovementCommand(0, 0, 120, self._moveX, -100)

		# Move Y
		self._addMovementCommand(0, 255, 0, self._moveY, -100)
		self._addMovementCommand(0, 240, 0, self._moveY, -10)
		self._addMovementCommand(0, 220, 0, self._moveY, -1)
		self._addMovementCommand(0, 200, 0, self._moveY, -0.1)
		self._addMovementCommand(0, 180, 0, self._moveY, 0.1)
		self._addMovementCommand(0, 160, 0, self._moveY, 1)
		self._addMovementCommand(0, 140, 0, self._moveY, 10)
		self._addMovementCommand(0, 120, 0, self._moveY, 100)

		# Move Z
		self._addMovementCommand(255, 0, 0, self._moveZ, 10)
		self._addMovementCommand(220, 0, 0, self._moveZ, 1)
		self._addMovementCommand(200, 0, 0, self._moveZ, 0.1)
		self._addMovementCommand(180, 0, 0, self._moveZ, -0.1)
		self._addMovementCommand(160, 0, 0, self._moveZ, -1)
		self._addMovementCommand(140, 0, 0, self._moveZ, -10)

		# Extrude/Retract
		self._addMovementCommand(255, 80, 0, self._moveE, 10)
		self._addMovementCommand(255, 180, 0, self._moveE, -10)

		# Home
		self._addMovementCommand(255, 255, 0, self._homeXYZ, None)
		self._addMovementCommand(240, 255, 0, self._homeXYZ, "X")
		self._addMovementCommand(220, 255, 0, self._homeXYZ, "Y")
		self._addMovementCommand(200, 255, 0, self._homeXYZ, "Z")

		self.powerWarningText = wx.StaticText(parent=self.toppanel,
			id=-1,
			label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetBackgroundColour('red')
		self.powerWarningText.SetForegroundColour('white')
		if power:
			self.powerManagement = power.PowerManagement()
		else:
			self.powerManagement = None
		self.powerWarningTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
		self.OnPowerWarningChange(None)
		self.powerWarningTimer.Start(10000)

		self.pauseTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPauseTimer, self.pauseTimer)

		self.connectButton = wx.Button(self.toppanel, -1, _("Connect"), size=(125, 30))
		self.printButton = wx.Button(self.toppanel, -1, _("Print"), size=(125, 30))
		self.cancelButton = wx.Button(self.toppanel, -1, _("Cancel"), size=(125, 30))
		self.errorLogButton = wx.Button(self.toppanel, -1, _("Error log"), size=(125, 30))
		self.motorsOffButton = wx.Button(self.toppanel, -1, _("Motors off"), size=(125, 30))
		self.movementBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window.png'))), (0, 0))
		self.temperatureBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature.png'))), (0, 0))
		self.temperatureField = TemperatureField(self.panel, self._setHotendTemperature)
		self.temperatureBedBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature-bed.png'))), (0, 0))
		self.temperatureBedField = TemperatureField(self.panel, self._setBedTemperature)
		self.temperatureGraph = TemperatureGraph(self.panel)
		self.temperatureGraph.SetMinSize((250, 100))
		self.progress = wx.Gauge(self.panel, -1, range=1000)

		f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
		self._termLog = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
		self._termLog.SetFont(f)
		self._termLog.SetEditable(0)
		self._termLog.SetMinSize((385, -1))
		self._termInput = wx.TextCtrl(self.panel, style=wx.TE_PROCESS_ENTER)
		self._termInput.SetFont(f)

		self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self._termInput)
		self._termInput.Bind(wx.EVT_CHAR, self.OnTermKey)

		self.topsizer.Add(self.powerWarningText, pos=(0, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM, border=5)
		self.topsizer.Add(self.connectButton, pos=(1, 0), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.printButton, pos=(1, 1), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.cancelButton, pos=(1, 2), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.errorLogButton, pos=(1, 4), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.motorsOffButton, pos=(1, 5), flag=wx.LEFT|wx.RIGHT, border=2)
		self.sizer.Add(self.movementBitmap, pos=(0, 0), span=(2, 3))
		self.sizer.Add(self.temperatureGraph, pos=(2, 0), span=(4, 2), flag=wx.EXPAND)
		self.sizer.Add(self.temperatureBitmap, pos=(2, 2))
		self.sizer.Add(self.temperatureField, pos=(3, 2))
		self.sizer.Add(self.temperatureBedBitmap, pos=(4, 2))
		self.sizer.Add(self.temperatureBedField, pos=(5, 2))
		self.sizer.Add(self._termLog, pos=(0, 3), span=(5, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self._termInput, pos=(5, 3), span=(1, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self.progress, pos=(7, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM)

		self.Bind(wx.EVT_SIZE, self.OnSize)
		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.movementBitmap.Bind(wx.EVT_LEFT_DOWN, self.OnMovementClick)
		self.temperatureGraph.Bind(wx.EVT_LEFT_UP, self.OnTemperatureClick)
		self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)
		self.motorsOffButton.Bind(wx.EVT_BUTTON, self.OnMotorsOff)

		self.Layout()
		self.Fit()
		self.Refresh()
		self.progress.SetMinSize(self.progress.GetSize())
		self._updateButtonStates()

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

		if self._printerConnection.hasActiveConnection() and \
		   not self._printerConnection.isActiveConnectionOpen():
			self._printerConnection.openActiveConnection()
	def __init__(self):
		wx.Frame.__init__(self, None, wx.ID_ANY, "Materials Selection", size=(500,400), style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP)
		
		analytics.submitFeatureAnalytics('1','','','','material_selector')
		
		# boxsizer initializations 
		mainBox = wx.BoxSizer(wx.VERTICAL)
		topBox = wx.BoxSizer(wx.VERTICAL)
		middleBox = wx.BoxSizer(wx.HORIZONTAL)
		listbox_Box1 = wx.BoxSizer(wx.VERTICAL)
		listbox_Box2 = wx.BoxSizer(wx.VERTICAL)
		bottomBox = wx.BoxSizer(wx.HORIZONTAL)
		
		# panel initialization
		listBoxPanel = wx.Panel(self, -1)
		
		# dict and option list initializations 
		materialsDirectory = resources.getSimpleModeMaterialsProfiles()
		self.materialsDict = self.createMaterialDict(materialsDirectory)
		brandsList = []
		materialsList = []
		
		# sort manufacturers and materials in their own lists
		for brand, materials in self.materialsDict.items():
			brandsList.append(brand)
			for material, path in materials.items():
				materialsList.append(material)
		
		brandsList = sorted(brandsList)
		# listbox initializations
		self.brandsBox = wx.ComboBox(listBoxPanel, -1, choices=sorted(brandsList), style=wx.CB_READONLY)
		self.matsBox = wx.ComboBox(listBoxPanel, -1, size=(150,-1), choices=sorted(materialsList), style=wx.CB_READONLY)
		
		self.brandsBox.SetSelection(0)
		
		matchingMaterials = []
		
		# manufacturer/mat matching logic
		index = self.brandsBox.GetSelection()
		matIndex = self.matsBox.GetSelection()
		
		if profile.getPreference('material_supplier') is None:
			self.selectedBrand = self.brandsBox.GetString(index)
		else:
			self.selectedBrand = profile.getPreference('material_supplier')
			newIndex = self.brandsBox.FindString(self.selectedBrand)
			self.brandsBox.SetSelection(newIndex)
				
		for brand, materials in self.materialsDict.items():
			if brand == self.selectedBrand:
				for material, path in materials.items():
					matchingMaterials.append(material)
					
		self.matsBox.Clear()

		for n in range(0, len(matchingMaterials)):
			self.matsBox.Append(matchingMaterials[n])

		self.matsBox.SetSelection(0)
		self.selectedMaterial = self.matsBox.GetString(0)
		
		if profile.getPreference('material_name') is None:
			self.selectedMaterial = self.matsBox.GetString(0)
		else:
			self.selectedMaterial = profile.getPreference('material_name')
			newIndex = self.matsBox.FindString(self.selectedMaterial)
			self.matsBox.SetSelection(newIndex)
			
		font = wx.Font(15, family=wx.SWISS, style=wx.NORMAL, weight=wx.NORMAL)
		
		# brand/title labels
		brandsLabel = wx.StaticText(listBoxPanel, -1, "Manufacturer")
		brandsLabel.SetFont(font)
		materialLabel = wx.StaticText(listBoxPanel, -1, "Material")
		materialLabel.SetFont(font)
		
		# select button
		self.selectButton = wx.Button(listBoxPanel, -1, 'Select')
		
		# load topBox
		logoPath = resources.getPathForImage('logoOutlineOrange.png')
		logoBitmap = wx.Image(logoPath)
		logoBitmap = logoBitmap.Scale(125, 125)
		logo = wx.StaticBitmap(listBoxPanel, -1, wx.BitmapFromImage(logoBitmap))
		titleText = wx.StaticText(listBoxPanel, -1, "Material Profile Selector")
		font = wx.Font(20, family=wx.SWISS, style=wx.NORMAL, weight=wx.NORMAL)
		titleText.SetFont(font)
		
		topBox.Add(logo, flag= wx.ALIGN_CENTER| wx.TOP, border=20)
		topBox.Add(titleText, flag=wx.BOTTOM | wx.TOP, border=10)

		
		# load listbox_Box1 with labels
		listbox_Box1.Add(brandsLabel, flag=wx.ALIGN_RIGHT)
		listbox_Box1.Add(materialLabel, flag=wx.TOP | wx.ALIGN_RIGHT, border=15)
		
		# load listBox2
		listbox_Box2.Add(self.brandsBox)
		listbox_Box2.Add(self.matsBox, flag=wx.TOP, border=10)
		
		# load bottomBox with 'Select' button
		bottomBox.Add(self.selectButton, flag=wx.ALIGN_CENTER)

		# load mainBox with all loaded boxsizers
		mainBox.Add(topBox, flag=wx.ALIGN_CENTER)
		middleBox.Add(listbox_Box1, flag=wx.LEFT)
		middleBox.Add(listbox_Box2, flag=wx.LEFT, border=10)
		mainBox.Add(middleBox, flag=wx.ALIGN_CENTER | wx.TOP, border=20)
		mainBox.Add(bottomBox, flag=wx.ALIGN_CENTER | wx.TOP, border=50)
		listBoxPanel.SetSizer(mainBox)
		
		# bindings
		self.brandsBox.Bind(wx.EVT_COMBOBOX, self.brandSelected)
		self.matsBox.Bind(wx.EVT_COMBOBOX, self.materialSelected)
		self.selectButton.Bind(wx.EVT_BUTTON, self.closeWindow)
Пример #44
0
	def __init__(self, files):
		if platform.system() == "Windows" and not 'PYCHARM_HOSTED' in os.environ:
	
			try:
				from Cura.util import profile
			except Exception as e:
				print e
			try:	
				super(CuraApp, self).__init__(redirect=True, filename=os.path.join(profile.getBasePath(), 'output_log.txt'))
			except Exception as e:
				print e
		else:
			super(CuraApp, self).__init__(redirect=False)


		self.mainWindow = None
		self.splash = None
		self.loadFiles = files

		self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate)

		if sys.platform.startswith('win'):
			#Check for an already running instance, if another instance is running load files in there
			from Cura.util import version
			from ctypes import windll
			import ctypes
			import socket
			import threading

			portNr = 0xCA00 + sum(map(ord, version.getVersion(False)))
			if len(files) > 0:
				try:
					other_hwnd = windll.user32.FindWindowA(None, ctypes.c_char_p('Cura - ' + version.getVersion()))
					if other_hwnd != 0:
						sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
						sock.sendto('\0'.join(files), ("127.0.0.1", portNr))

						windll.user32.SetForegroundWindow(other_hwnd)
						return
				except:
					pass

			socketListener = threading.Thread(target=self.Win32SocketListener, args=(portNr,))
			socketListener.daemon = True
			socketListener.start()



		if sys.platform.startswith('darwin'):
			#Do not show a splashscreen on OSX, as by Apple guidelines
			self.afterSplashCallback()
		else:
			from Cura.util.resources import getPathForImage
	#		from Cura.gui import splashScreen
	#		self.splash = splashScreen.splashScreen(self.afterSplashCallback)
			splashBitmap = wx.Image(getPathForImage('splash.png')).ConvertToBitmap()
			splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT
			splashDuration = 500

			splash = wx.SplashScreen(splashBitmap, splashStyle, splashDuration, None)
			splash.Show()

			self.afterSplashCallback()
Пример #45
0
	def __init__(self, parent, printerConnection):
		super(printWindowBasic, self).__init__(parent, -1, style=wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX|wx.FRAME_FLOAT_ON_PARENT, title=_("Printing on %s") % (printerConnection.getName()))
		self._parent = parent

		frameicon = wx.Icon(resources.getPathForImage('cura.ico'), wx.BITMAP_TYPE_ICO)
		self.SetIcon(frameicon)

		self._printerConnection = printerConnection
		self._lastUpdateTime = 0

		panel = wx.Panel(self)

		self.powerWarningText = wx.StaticText(parent=panel,
			id=-1,
			label=_("Your computer is maybe running on battery power.\nPlease check that your computer is connected to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetForegroundColour((169, 68, 66))

		self.statusText = wx.StaticText(panel, -1)
		statusFont = self.statusText.GetFont()
		statusFont.SetStyle(wx.FONTSTYLE_ITALIC)
		self.statusText.SetFont(statusFont)

		self.noozleTemperatureText = wx.StaticText(panel, -1)
		self.bedTemperatureText = wx.StaticText(panel, -1)

		self.printButton = wx.Button(panel, -1, _("Print"))
		self.pauseButton = wx.Button(panel, -1, _("Pause"))
		self.cancelButton = wx.Button(panel, -1, _("Cancel print"))
		self.logButton = wx.Button(panel, -1, _("Log"))

		buttonsSizer = wx.BoxSizer(wx.HORIZONTAL)
		buttonsSizer.Add(self.printButton)
		buttonsSizer.Add(self.pauseButton)
		buttonsSizer.Add(self.cancelButton)
		buttonsSizer.Add(self.logButton)

		self.progress = wx.Gauge(panel, -1, range=1000)

		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(self.powerWarningText, flag=wx.BOTTOM, border=5)
		sizer.Add(self.statusText, flag=wx.BOTTOM, border=5)
		sizer.Add(self.noozleTemperatureText)
		sizer.Add(self.bedTemperatureText, flag=wx.BOTTOM, border=5)
		sizer.Add(buttonsSizer)
		sizer.Add(self.progress, flag=wx.EXPAND)

		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.pauseButton.Bind(wx.EVT_BUTTON, self.OnPause)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.logButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)

		panel.SetSizerAndFit(sizer)
		panel.Layout()
		self.Fit()
		self.Centre()

		self._updateButtonStates()

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

		if self._printerConnection.hasActiveConnection() and not self._printerConnection.isActiveConnectionOpen():
			self._printerConnection.openActiveConnection()
		preventComputerFromSleeping(True)
Пример #46
0
	def __init__(self, parent, printerConnection):
		super(printWindowAdvanced, self).__init__(parent, -1, style=wx.CLOSE_BOX|wx.CLIP_CHILDREN|wx.CAPTION|wx.SYSTEM_MENU|wx.FRAME_FLOAT_ON_PARENT|wx.MINIMIZE_BOX, title=_("Printing on %s") % (printerConnection.getName()))
		self._printerConnection = printerConnection
		self._lastUpdateTime = time.time()
		self._isPrinting = False

		self.SetSizer(wx.BoxSizer(wx.VERTICAL))
		self.toppanel = wx.Panel(self)
		self.topsizer = wx.GridBagSizer(2, 2)
		self.toppanel.SetSizer(self.topsizer)
		self.toppanel.SetBackgroundColour(wx.WHITE)
		self.topsizer.SetEmptyCellSize((125, 1))
		self.panel = wx.Panel(self)
		self.sizer = wx.GridBagSizer(2, 2)
		self.sizer.SetEmptyCellSize((125, 1))
		self.panel.SetSizer(self.sizer)
		self.panel.SetBackgroundColour(wx.WHITE)
		self.GetSizer().Add(self.toppanel, 0, flag=wx.EXPAND)
		self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)

		self._fullscreenTemperature = None
		self._termHistory = []
		self._termHistoryIdx = 0

		self._mapImage = wx.Image(resources.getPathForImage('print-window-map.png'))
		self._colorCommandMap = {}

		# Move X
		self._addMovementCommand(0, 0, 255, self._moveX, 100)
		self._addMovementCommand(0, 0, 240, self._moveX, 10)
		self._addMovementCommand(0, 0, 220, self._moveX, 1)
		self._addMovementCommand(0, 0, 200, self._moveX, 0.1)
		self._addMovementCommand(0, 0, 180, self._moveX, -0.1)
		self._addMovementCommand(0, 0, 160, self._moveX, -1)
		self._addMovementCommand(0, 0, 140, self._moveX, -10)
		self._addMovementCommand(0, 0, 120, self._moveX, -100)

		# Move Y
		self._addMovementCommand(0, 255, 0, self._moveY, -100)
		self._addMovementCommand(0, 240, 0, self._moveY, -10)
		self._addMovementCommand(0, 220, 0, self._moveY, -1)
		self._addMovementCommand(0, 200, 0, self._moveY, -0.1)
		self._addMovementCommand(0, 180, 0, self._moveY, 0.1)
		self._addMovementCommand(0, 160, 0, self._moveY, 1)
		self._addMovementCommand(0, 140, 0, self._moveY, 10)
		self._addMovementCommand(0, 120, 0, self._moveY, 100)

		# Move Z
		self._addMovementCommand(255, 0, 0, self._moveZ, 10)
		self._addMovementCommand(220, 0, 0, self._moveZ, 1)
		self._addMovementCommand(200, 0, 0, self._moveZ, 0.1)
		self._addMovementCommand(180, 0, 0, self._moveZ, -0.1)
		self._addMovementCommand(160, 0, 0, self._moveZ, -1)
		self._addMovementCommand(140, 0, 0, self._moveZ, -10)

		# Extrude/Retract
		self._addMovementCommand(255, 80, 0, self._moveE, 10)
		self._addMovementCommand(255, 180, 0, self._moveE, -10)

		# Home
		self._addMovementCommand(255, 255, 0, self._homeXYZ, None)
		self._addMovementCommand(240, 255, 0, self._homeXYZ, "X")
		self._addMovementCommand(220, 255, 0, self._homeXYZ, "Y")
		self._addMovementCommand(200, 255, 0, self._homeXYZ, "Z")

		self.powerWarningText = wx.StaticText(parent=self.toppanel,
			id=-1,
			label=_("Your computer is running on battery power.\nConnect your computer to AC power or your print might not finish."),
			style=wx.ALIGN_CENTER)
		self.powerWarningText.SetBackgroundColour('red')
		self.powerWarningText.SetForegroundColour('white')
		self.powerManagement = power.PowerManagement()
		self.powerWarningTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPowerWarningChange, self.powerWarningTimer)
		self.OnPowerWarningChange(None)
		self.powerWarningTimer.Start(10000)

		self.pauseTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnPauseTimer, self.pauseTimer)

		self.connectButton = wx.Button(self.toppanel, -1, _("Connect"), size=(125, 30))
		self.printButton = wx.Button(self.toppanel, -1, _("Print"), size=(125, 30))
		self.cancelButton = wx.Button(self.toppanel, -1, _("Cancel"), size=(125, 30))
		self.errorLogButton = wx.Button(self.toppanel, -1, _("Error log"), size=(125, 30))
		self.motorsOffButton = wx.Button(self.toppanel, -1, _("Motors off"), size=(125, 30))
		self.movementBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window.png'))), (0, 0))
		self.temperatureBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature.png'))), (0, 0))
		self.temperatureField = TemperatureField(self.panel, self._setHotendTemperature)
		self.temperatureBedBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(wx.Image(
				resources.getPathForImage('print-window-temperature-bed.png'))), (0, 0))
		self.temperatureBedField = TemperatureField(self.panel, self._setBedTemperature)
		self.temperatureGraph = TemperatureGraph(self.panel)
		self.temperatureGraph.SetMinSize((250, 100))
		self.progress = wx.Gauge(self.panel, -1, range=1000)

		f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
		self._termLog = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE)
		self._termLog.SetFont(f)
		self._termLog.SetEditable(0)
		self._termLog.SetMinSize((385, -1))
		self._termInput = wx.TextCtrl(self.panel, style=wx.TE_PROCESS_ENTER)
		self._termInput.SetFont(f)

		self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self._termInput)
		self._termInput.Bind(wx.EVT_CHAR, self.OnTermKey)

		self.topsizer.Add(self.powerWarningText, pos=(0, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM, border=5)
		self.topsizer.Add(self.connectButton, pos=(1, 0), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.printButton, pos=(1, 1), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.cancelButton, pos=(1, 2), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.errorLogButton, pos=(1, 4), flag=wx.LEFT, border=2)
		self.topsizer.Add(self.motorsOffButton, pos=(1, 5), flag=wx.LEFT|wx.RIGHT, border=2)
		self.sizer.Add(self.movementBitmap, pos=(0, 0), span=(2, 3))
		self.sizer.Add(self.temperatureGraph, pos=(2, 0), span=(4, 2), flag=wx.EXPAND)
		self.sizer.Add(self.temperatureBitmap, pos=(2, 2))
		self.sizer.Add(self.temperatureField, pos=(3, 2))
		self.sizer.Add(self.temperatureBedBitmap, pos=(4, 2))
		self.sizer.Add(self.temperatureBedField, pos=(5, 2))
		self.sizer.Add(self._termLog, pos=(0, 3), span=(5, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self._termInput, pos=(5, 3), span=(1, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		self.sizer.Add(self.progress, pos=(7, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM)

		self.Bind(wx.EVT_SIZE, self.OnSize)
		self.Bind(wx.EVT_CLOSE, self.OnClose)
		self.movementBitmap.Bind(wx.EVT_LEFT_DOWN, self.OnMovementClick)
		self.temperatureGraph.Bind(wx.EVT_LEFT_UP, self.OnTemperatureClick)
		self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
		self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
		self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
		self.errorLogButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)
		self.motorsOffButton.Bind(wx.EVT_BUTTON, self.OnMotorsOff)

		self.Layout()
		self.Fit()
		self.Refresh()
		self.progress.SetMinSize(self.progress.GetSize())
		self._updateButtonStates()

		self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

		if self._printerConnection.hasActiveConnection() and \
		   not self._printerConnection.isActiveConnectionOpen():
			self._printerConnection.openActiveConnection()
	def __init__(self, parent):
		super(expertConfigWindow, self).__init__(None, title='Debug Settings', style=wx.DEFAULT_DIALOG_STYLE)
		wx.EVT_CLOSE(self, self.OnClose)
		self.panel = configBase.configPanelBase(self)
		self.parent = parent
		left, right, main = self.panel.CreateConfigPanel(self)

		if platform.system() == 'Windows':
			ico = wx.Icon(getPathForImage(_('../suite.ico')), wx.BITMAP_TYPE_ICO)
			self.SetIcon(ico)
		
		self.configList = []
		
		configBase.TitleRow(left, "Speed")
		# c = configBase.SettingRow(left, "Minimum layer time (seconds) ", 'cool_min_layer_time', '6', 'If a layer would finish too quickly, the print will slow down so it takes this amount of time to finish the layer.')
		# self.configList.append(c)
		# validators.validFloat(c, 0.0)
		c = configBase.SettingRow(left, "Travel Speed (mm/s) ", 'travel_speed', '200', 'How fast the extruder moves while not printing.')
		self.configList.append(c)
		validators.validFloat(c, 50, 250)
		
		# c = configBase.SettingRow(left, "Bridge Feed (%)", 'bridge_feed_ratio', '100', 'Speed at which layers with bridges travel, compared to normal printing speed.')
		# self.configList.append(c)
		# validators.validFloat(c, 0.0)
		# c = configBase.SettingRow(left, "Bridge Flow (%)", 'bridge_flow_ratio', '105', 'Speed at which layers with bridges are printed, compared to normal printing speed.')
		# self.configList.append(c)
		# validators.validFloat(c, 0.0)
		
		c = configBase.SettingRow(left, "Perimeter Speed (%)", 'perimeter_speed_ratio', '50', 'Speed at which the perimeter will be printed, compared to the infill.')
		self.configList.append(c)
		validators.validFloat(c, 10.0, 150.0)

		# configBase.TitleRow(left, "Cool")
		# c = configBase.SettingRow(left, "Minimum feedrate (mm/s)", 'cool_min_feedrate', '5', 'The minimal layer time can cause the print to slow down so much it starts to ooze. The minimal feedrate protects against this. Even if a print gets slown down it will never be slower then this minimal feedrate.')
		# self.configList.append(c)
		# validators.validFloat(c, 0.0)
		# c = configBase.SettingRow(left, "Fan on layer number (#)", 'fan_layer', '1', 'The layer at which the fan is turned on. The first layer is layer 0. The first layer can stick better if you turn the fan on the 2nd layer.')
		# self.configList.append(c)
		# validators.validInt(c, 0)
		# c = configBase.SettingRow(left, "Fan speed min (%)", 'fan_speed', '100', 'When the fan is turned on, it is enabled at this speed setting. If cool slows down the layer, the fan is adjusted between the min and max speed. Minimal fan speed is used if the layer is not slowed down due to cooling.')
		# self.configList.append(c)
		# validators.validInt(c, 0, 100)
		# c = configBase.SettingRow(left, "Fan speed max (%)", 'fan_speed_max', '100', 'When the fan is turned on, it is enabled at this speed setting. If cool slows down the layer, the fan is adjusted between the min and max speed. Maximal fan speed is used if the layer is slowed down due to cooling by more then 200%.')
		# self.configList.append(c)
		# validators.validInt(c, 0, 100)

		configBase.TitleRow(left, "Skirt")
		c = configBase.SettingRow(left, "Skirt line count (#)", 'skirt_line_count', '2', 'The number of loops the print will draw outside the object on the first layer. This is to ensure the filament is flowing well before starting the print.')
		self.configList.append(c)
		validators.validInt(c, 0, 10)
		c = configBase.SettingRow(left, "Skirt gap width (mm)", 'skirt_gap', '2.0', 'How far the skirt will be placed from the actual object.')
		self.configList.append(c)
		validators.validInt(c, 0, 10)

		c = configBase.SettingRow(left, "Brim", 'brim_enable', ['Off', 'Enabled'], 'Generates the skirt touching the object. This helps keep the print from lifting. If this is enabled, skirt settings will not be used.')
		c.defaultValue = 'Off'
		self.configList.append(c)
		c = configBase.SettingRow(left, "Brim Line Count", 'brim_line_count', '5', 'The number of loops that will be generated if Brim is enabled.')
		self.configList.append(c)
		validators.validInt(c, 0, 20)

		# configBase.TitleRow(left, "Size")
		# c = configBase.SettingRow(left, "Custom Machine Depth (mm)", 'custom_machine_depth', '200', 'Custom Machine Depth')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		# c = configBase.SettingRow(left, "Custom Machine Width (mm)", 'custom_machine_width', '200', 'Custom Machine Width')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		# c = configBase.SettingRow(left, "Custom Machine Height (mm)", 'custom_machine_height', '200', 'Custom Machine Height')
		# self.configList.append(c)
		# validators.validFloat(c, 0)

		# configBase.TitleRow(left, "Material")
		# c = configBase.SettingRow(left, "Filament Density (ratio)", 'filament_density', '1', 'Density of the material. 1.0 for PLA. 0.9 for x')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		# c = configBase.SettingRow(left, "Infill Width (mm)", 'infill_width', '0.4', 'The width of the infill.')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		# c = configBase.SettingRow(left, "Perimeter flow ", 'perimeter_flow_ratio', '75', 'The flow rate of the perimeter')
		# self.configList.append(c)
		# validators.validFloat(c, 0)

		configBase.TitleRow(left, "Infill")
		c = configBase.SettingRow(left, "Infill (%)", 'fill_density', '18', 'How dense the inside of your print will be.')
		self.configList.append(c)
		validators.validFloat(c, 0, 100)
		# c = configBase.SettingRow(left, "Infill overlap (%)", 'fill_overlap', '0', 'Amount of overlap between the infill and the walls. There is a slight overlap with the walls and the infill so the walls connect firmly to the infill.')
		# self.configList.append(c)
		# validators.validFloat(c, 0.0)

		#c = configBase.SettingRow(left, "Enable Brim", 'fan_speed', '100', 'When the fan is turned on, it is enabled at this speed setting. If cool slows down the layer, the fan is adjusted between the min and max speed. Minimal fan speed is used if the layer is not slowed down due to cooling.')
		#validators.validInt(c, 0, 100)
		
		#configBase.TitleRow(left, "Raft (if enabled)")
		#c = configBase.SettingRow(left, "Extra margin (mm)", 'raft_margin', '3.0', 'If the raft is enabled, this is the extra raft area around the object which is also rafted. Increasing this margin will create a stronger raft.')
		#validators.validFloat(c, 0.0)
		#c = configBase.SettingRow(left, "Base material amount (%)", 'raft_base_material_amount', '100', 'The base layer is the first layer put down as a raft. This layer has thick strong lines and is put firmly on the bed to prevent warping. This setting adjust the amount of material used for the base layer.')
		#validators.validFloat(c, 0.0)
		#c = configBase.SettingRow(left, "Interface material amount (%)", 'raft_interface_material_amount', '100', 'The interface layer is a weak thin layer between the base layer and the printed object. It is designed to has little material to make it easy to break the base off the printed object. This setting adjusts the amount of material used for the interface layer.')
		#validators.validFloat(c, 0.0)

		#configBase.TitleRow(left, "Support")
		#c = configBase.SettingRow(left, "Material amount (%)", 'support_rate', '100', 'Amount of material used for support, less material gives a weaker support structure which is easier to remove.')
		#validators.validFloat(c, 0.0)
		#c = configBase.SettingRow(left, "Distance from object (mm)", 'support_distance', '0.5', 'Distance between the support structure and the object. Empty gap in which no support structure is printed.')
		#validators.validFloat(c, 0.0)

		
		configBase.TitleRow(left, "Top/Bottom")
		# c = configBase.SettingRow(right, "Infill pattern", 'infill_type', ['Line', 'Grid Circular', 'Grid Hexagonal', 'Grid Rectangular'], 'Pattern of the none-solid infill. Line is default, but grids can provide a strong print.')
		# self.configList.append(c)
		c = configBase.SettingRow(left, "Bottom surface layers (#) ", 'bottom_surface_thickness_layers', '2', 'Number of solid layers from the bottom of the print.')
		self.configList.append(c)
		validators.validFloat(c, 0, 6)
		c = configBase.SettingRow(left, "Top surface layers (#) ", 'top_surface_thickness_layers', '3', 'Number of solid layers from the top of the print.')
		self.configList.append(c)
		validators.validFloat(c, 0, 6)

		
		# c = configBase.SettingRow(right, "Infill in direction of bridge", 'bridge_direction', True, 'If this is on, infill will fill in the direction of bridging. This improves bridging but may increase print time.')
		# self.configList.append(c)

	
		configBase.TitleRow(right, "Retraction")
		c = configBase.SettingRow(right, "Retraction speed (mm/s) ", 'retraction_speed', '80.0', 'How quickly the extruder does a retract command.')
		self.configList.append(c)
		validators.validFloat(c, 0, 200)
		c = configBase.SettingRow(right, "Retraction amount (mm) ", 'retraction_amount', '0.8', 'How much distance the extruder will retract.')
		self.configList.append(c)
		validators.validFloat(c, 0, 5)
		# c = configBase.SettingRow(right, "Retraction extra amount (mm) ", 'retraction_extra', '0.0', 'How much extra the extruder will retract with each retract command.')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		
		# configBase.TitleRow(right, "First Layer")
		# c = configBase.SettingRow(right, "First layer temperature (#) ", 'first_layer_print_temperature', '220', 'How hot the extruder will print at during the first layer.')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		#c = configBase.SettingRow(right, "First layer height (mm) ", 'bottom_thickness', '0.2', 'Create a solid top surface, if set to false the top is filled with the fill percentage. Useful for cups/vases.')
		#validators.validFloat(c, 0)
		# c = configBase.SettingRow(right, "First layer speed (mm/s) ", 'bottom_layer_speed', '30', 'How fast the print will print at during the first layer.')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
	
		# configBase.TitleRow(right, "Clip")
		# c = configBase.SettingRow(right, "Organic Clip", 'organic_clip', False, 'Attempts to hide the start and end points of each layer. Works well with organic shapes.')
		# self.configList.append(c)
		#c = configBase.SettingRow(right, "Clip (mm)", 'clip', '0.0', 'How close the beginning and the end of a perimeter meet. A higher number increase the distance.')
		#self.configList.append(c)
		#validators.validFloat(c, 0.0)

		configBase.TitleRow(right, "Support")
		c = configBase.SettingRow(right, "Support Type", 'support', ['None', 'Exterior Only', 'Everywhere'], 'Where the supports will be generated.')
		c.defaultValue = 'None'
		self.configList.append(c)
		c = configBase.SettingRow(right, "Support Type", 'support_type', ['Lines', 'Grid'], 'What pattern the supports will be generated as. Lines will create single walled supports that are easy to remove. Grid will create a strong cross-hatch pattern but may be difficult to remove.')
		c.defaultValue = 'Lines'
		self.configList.append(c)
		c = configBase.SettingRow(right, "Support Infill (%)", 'support_fill_rate', '20', 'How dense the generated support will be. The higher the number, the more support will be generated.')
		self.configList.append(c)
		validators.validFloat(c, 0, 100)
		c = configBase.SettingRow(right, "Support X/Y Distance (mm)", 'support_xy_distance', '0.6', 'The distance the support will be generated from the X/Y plane.')
		self.configList.append(c)
		validators.validFloat(c, 0.3, 1)
		#validators.validFloat(c, 0)
		# c = configBase.SettingRow(right, "Support Density", 'support_density', '0.3', 'How dense the support will be.')
		# self.configList.append(c)
		# validators.validFloat(c, 0)
		c = configBase.SettingRow(right, "Support Angle (degrees)", 'support_angle', '65', 'The minimum angle required for support to be generated')
		self.configList.append(c)
		validators.validFloat(c, 45, 90)
		c = configBase.SettingRow(right, "Extra Support (mm)", 'extra_support_amount', '0', 'Widens generated support to accomodate for thinner parts that need support.')
		self.configList.append(c)
		validators.validFloat(c, 0, 5)
		c = configBase.SettingRow(right, "Support Extrusion Width (mm)", 'support_extrusion_width', '0.3', 'Extrusion width for support material')
		self.configList.append(c)
		validators.validFloat(c, 0, 1)
		
		#configBase.TitleRow(right, "Sequence")
		#c = configBase.SettingRow(right, "Print order sequence", 'sequence', ['Loops > Perimeter > Infill', 'Loops > Infill > Perimeter', 'Infill > Loops > Perimeter', 'Infill > Perimeter > Loops', 'Perimeter > Infill > Loops', 'Perimeter > Loops > Infill'], 'Sequence of printing. The perimeter is the outer print edge, the loops are the insides of the walls, and the infill is the insides.');
		#c = configBase.SettingRow(right, "Force first layer sequence", 'force_first_layer_sequence', True, 'This setting forces the order of the first layer to be \'Perimeter > Loops > Infill\'')

		#configBase.TitleRow(right, "Joris")
		#c = configBase.SettingRow(right, "Joris the outer edge", 'joris', False, '[Joris] is a code name for smoothing out the Z move of the outer edge. This will create a steady Z increase over the whole print. It is intended to be used with a single walled wall thickness to make cups/vases.')

		#configBase.TitleRow(right, "Retraction")
		#c = configBase.SettingRow(right, "Retract on jumps only", 'retract_on_jumps_only', True, 'Only retract when we are making a move that is over a hole in the model, else retract on every move. This effects print quality in different ways.')

		#configBase.TitleRow(right, "Hop")
		#c = configBase.SettingRow(right, "Enable hop on move", 'hop_on_move', False, 'When moving from print position to print position, raise the printer head 0.2mm so it does not knock off the print (experimental).')
		
		#def __init__(self, panel, name):
		"Add a title row to the configuration panel"
		sizer = right.GetSizer()
		x = sizer.GetRows()
		#self.title = wx.StaticText(right, -1, "ahh")
		#self.title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
		#sizer.Add(self.title, (x,0), (1,3), flag=wx.EXPAND|wx.TOP|wx.LEFT, border=10)
		self.ln = wx.StaticLine(right, -1)

		self.okButton = wx.Button(right, -1, 'Save')
		self.okButton2 = wx.Button(right, -1, 'Close')
		self.okButton3 = wx.Button(right, -1, 'Reset Debug Settings')
		
		mySizer = wx.GridBagSizer(3, 2)
		mySizer.Add(self.okButton, (2,0), (1,1), flag=wx.EXPAND|wx.TOP|wx.RIGHT,border=5)
		mySizer.Add(self.okButton2, (2,1), (1,1), flag=wx.EXPAND|wx.TOP|wx.RIGHT,border=5)
		mySizer.Add(self.okButton3, (2,2), (1,1), flag=wx.EXPAND|wx.TOP|wx.RIGHT,border=5)
		sizer.Add(mySizer, (x,0), (1,3), flag=wx.EXPAND|wx.LEFT,border=10)
		
		sizer.SetRows(x )
		
		#self.ln = wx.StaticLine(panel, -1)

		#sizer.SetRows(x + 2)
		
		self.Bind(wx.EVT_BUTTON, lambda e: self.saveAll(), self.okButton) #TODO: have a "settings saved!" message/promt
		self.Bind(wx.EVT_BUTTON, lambda e: self.Close(), self.okButton2) #TODO: make a window promt asking to save changes if there are any
		self.Bind(wx.EVT_BUTTON, lambda e: self.resetSettings(), self.okButton3) #TODO: make a window promt asking to save changes if there are any

		#buttonPanel.SetSizer(sizer)

		#sizer.Add(leftConfigPanel, border=35, flag=wx.RIGHT)
		
		#self.okButton = wx.Button(self, -1, 'Ok')
		#sizer.Add(self.okButton, (0, 0))
		#sizer.Add(right, (1, 0))

		#self.okButton2 = wx.Button(left, -1, 'Ok')
		#left.GetSizer().Add(self.okButton2, (left.GetSizer().GetRows(), 1))
		#self.okButton3 = wx.Button(left, -1, 'Ok')
		#left.GetSizer().Add(self.okButton3, (left.GetSizer().GetRows(), 2))
		
		#self.Bind(wx.EVT_BUTTON, lambda e: self.Close(), self.okButton)
		
		main.Fit()
		self.Fit()
Пример #48
0
	def __init__(self, parent, manager, ym):
		super(newDesignWindow, self).__init__(parent, title='Share on YouMagine')
		p = wx.Panel(self)
		self.SetSizer(wx.BoxSizer())
		self.GetSizer().Add(p, 1, wx.EXPAND)
		self._manager = manager
		self._ym = ym

		categoryOptions = ym.getCategories()
		licenseOptions = ym.getLicenses()
		self._designName = wx.TextCtrl(p, -1, _("Design name"))
		self._designDescription = wx.TextCtrl(p, -1, '', size=(1, 150), style = wx.TE_MULTILINE)
		self._designLicense = wx.ComboBox(p, -1, licenseOptions[0], choices=licenseOptions, style=wx.CB_DROPDOWN|wx.CB_READONLY)
		self._category = wx.ComboBox(p, -1, categoryOptions[-1], choices=categoryOptions, style=wx.CB_DROPDOWN|wx.CB_READONLY)
		self._publish = wx.CheckBox(p, -1, _("Publish after upload"))
		self._shareButton = wx.Button(p, -1, _("Share!"))
		self._imageScroll = wx.lib.scrolledpanel.ScrolledPanel(p)
		self._additionalFiles = wx.CheckListBox(p, -1)
		self._additionalFiles.InsertItems(getAdditionalFiles(self._manager._scene.objects(), True), 0)
		self._additionalFiles.SetChecked(range(0, self._additionalFiles.GetCount()))
		self._additionalFiles.InsertItems(getAdditionalFiles(self._manager._scene.objects(), False), self._additionalFiles.GetCount())

		self._imageScroll.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
		self._addImageButton = wx.Button(self._imageScroll, -1, _("Add..."), size=(70,52))
		self._imageScroll.GetSizer().Add(self._addImageButton)
		self._snapshotButton = wx.Button(self._imageScroll, -1, _("Webcam..."), size=(70,52))
		self._imageScroll.GetSizer().Add(self._snapshotButton)
		if not webcam.hasWebcamSupport():
			self._snapshotButton.Hide()
		self._imageScroll.Fit()
		self._imageScroll.SetupScrolling(scroll_x=True, scroll_y=False)
		self._imageScroll.SetMinSize((20, self._imageScroll.GetSize()[1] + wx.SystemSettings_GetMetric(wx.SYS_HSCROLL_Y)))

		self._publish.SetValue(True)
		self._publish.SetToolTipString(
			_("Directly publish the design after uploading.\nWithout this check the design will not be public\nuntil you publish it yourself on YouMagine.com"))

		s = wx.GridBagSizer(5, 5)
		p.SetSizer(s)

		s.Add(wx.StaticBitmap(p, -1, wx.Bitmap(getPathForImage('youmagine-text.png'))), (0,0), span=(1,3), flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
		s.Add(wx.StaticText(p, -1, _("Design name:")), (1, 0), flag=wx.LEFT|wx.TOP, border=5)
		s.Add(self._designName, (1, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticText(p, -1, _("Description:")), (2, 0), flag=wx.LEFT|wx.TOP, border=5)
		s.Add(self._designDescription, (2, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticText(p, -1, _("Category:")), (3, 0), flag=wx.LEFT|wx.TOP, border=5)
		s.Add(self._category, (3, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticText(p, -1, _("License:")), (4, 0), flag=wx.LEFT|wx.TOP, border=5)
		s.Add(self._designLicense, (4, 1), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticLine(p, -1), (5,0), span=(1,3), flag=wx.EXPAND|wx.ALL)
		s.Add(wx.StaticText(p, -1, _("Images:")), (6, 0), flag=wx.LEFT|wx.TOP, border=5)
		s.Add(self._imageScroll, (6, 1), span=(1, 2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticLine(p, -1), (7,0), span=(1,3), flag=wx.EXPAND|wx.ALL)
		s.Add(wx.StaticText(p, -1, _("Related design files:")), (8, 0), flag=wx.LEFT|wx.TOP, border=5)

		s.Add(self._additionalFiles, (8, 1), span=(1, 2), flag=wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5)
		s.Add(wx.StaticLine(p, -1), (9,0), span=(1,3), flag=wx.EXPAND|wx.ALL)
		s.Add(self._shareButton, (10, 1), flag=wx.BOTTOM, border=15)
		s.Add(self._publish, (10, 2), flag=wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL, border=15)

		s.AddGrowableRow(2)
		s.AddGrowableCol(2)

		self.Bind(wx.EVT_BUTTON, self.OnShare, self._shareButton)
		self.Bind(wx.EVT_BUTTON, self.OnAddImage, self._addImageButton)
		self.Bind(wx.EVT_BUTTON, self.OnTakeImage, self._snapshotButton)

		self.Fit()
		self.Centre()

		self._designDescription.SetMinSize((1,1))
		self._designName.SetFocus()
		self._designName.SelectAll()
Пример #49
0
	def __init__(self, callback):
		self.callback = callback
		bitmap = wx.Bitmap(getPathForImage('splash-chinese.png'))
		super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN, 0, None)
		wx.CallAfter(self.DoCallback)
Пример #50
0
	def __init__(self):
		super(mainWindow, self).__init__(None, title=_('Tinkerine Suite - ') + version.getVersion())
		#super(mainWindow, self).__init__(None, title='Cura - ' + version.getVersion(),style=wx.DEFAULT_FRAME_STYLE & wx.NO_BORDER & ~wx.SYSTEM_MENU)


		ico = wx.Icon(getPathForImage(_('../suite.ico')), wx.BITMAP_TYPE_ICO)
		self.SetIcon(ico)

		self.extruderCount = int(profile.getPreference('extruder_amount'))

		wx.EVT_CLOSE(self, self.OnClose)

		self.SetDropTarget(dropTarget.FileDropTarget(self.OnDropFiles, meshLoader.loadSupportedExtensions()))

		self.normalModeOnlyItems = []

		mruFile = os.path.join(profile.getBasePath(), 'mru_filelist.ini')
		self.config = wx.FileConfig(appName=_("Tinkerine Suite"),
						localFilename=mruFile,
						style=wx.CONFIG_USE_LOCAL_FILE)
						
		self.ID_MRU_MODEL1, self.ID_MRU_MODEL2, self.ID_MRU_MODEL3, self.ID_MRU_MODEL4, self.ID_MRU_MODEL5, self.ID_MRU_MODEL6, self.ID_MRU_MODEL7, self.ID_MRU_MODEL8, self.ID_MRU_MODEL9, self.ID_MRU_MODEL10 = [wx.NewId() for line in xrange(10)]
		self.modelFileHistory = wx.FileHistory(10, self.ID_MRU_MODEL1)
		self.config.SetPath("/ModelMRU")
		self.modelFileHistory.Load(self.config)

		self.ID_MRU_PROFILE1, self.ID_MRU_PROFILE2, self.ID_MRU_PROFILE3, self.ID_MRU_PROFILE4, self.ID_MRU_PROFILE5, self.ID_MRU_PROFILE6, self.ID_MRU_PROFILE7, self.ID_MRU_PROFILE8, self.ID_MRU_PROFILE9, self.ID_MRU_PROFILE10 = [wx.NewId() for line in xrange(10)]
		self.profileFileHistory = wx.FileHistory(10, self.ID_MRU_PROFILE1)
		self.config.SetPath("/ProfileMRU")
		self.profileFileHistory.Load(self.config)

		self.menubar = wx.MenuBar()
		self.fileMenu = wx.Menu()
		i = self.fileMenu.Append(-1, _('Load model file...\tCTRL+L'))
		self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i)
		i = self.fileMenu.Append(-1, _('Save model...\tCTRL+S'))
		self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i)
		i = self.fileMenu.Append(-1, _('Clear platform'))
		self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i)

		#self.fileMenu.AppendSeparator()
		#i = self.fileMenu.Append(-1, 'Print...\tCTRL+P')
		#self.Bind(wx.EVT_MENU, lambda e: self.scene.showPrintWindow(), i)
		#i = self.fileMenu.Append(-1, 'Save GCode...')
		#self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i)
		#i = self.fileMenu.Append(-1, 'Show slice engine log...')
		#self.Bind(wx.EVT_MENU, lambda e: self.scene._showSliceLog(), i)

		#self.fileMenu.AppendSeparator()
		#i = self.fileMenu.Append(-1, 'Open Profile...')
		#self.normalModeOnlyItems.append(i)
		#self.Bind(wx.EVT_MENU, self.OnLoadProfile, i)
		#i = self.fileMenu.Append(-1, 'Save Profile...')
		#self.normalModeOnlyItems.append(i)
		#self.Bind(wx.EVT_MENU, self.OnSaveProfile, i)
		#i = self.fileMenu.Append(-1, 'Load Profile from GCode...')
		#self.normalModeOnlyItems.append(i)
		#self.Bind(wx.EVT_MENU, self.OnLoadProfileFromGcode, i)
		#self.fileMenu.AppendSeparator()
		#i = self.fileMenu.Append(-1, 'Reset Profile to default')
		#self.normalModeOnlyItems.append(i)
		#self.Bind(wx.EVT_MENU, self.OnResetProfile, i)

		#self.fileMenu.AppendSeparator()
		#i = self.fileMenu.Append(-1, 'Preferences...\tCTRL+,')
		#self.Bind(wx.EVT_MENU, self.OnPreferences, i)
		self.fileMenu.AppendSeparator()

		# Model MRU list
		modelHistoryMenu = wx.Menu()
		self.fileMenu.AppendMenu(wx.NewId(), _("&Recent Model Files"), modelHistoryMenu)
		self.modelFileHistory.UseMenu(modelHistoryMenu)
		self.modelFileHistory.AddFilesToMenu()
		self.Bind(wx.EVT_MENU_RANGE, self.OnModelMRU, id=self.ID_MRU_MODEL1, id2=self.ID_MRU_MODEL10)

		# Profle MRU list
		#profileHistoryMenu = wx.Menu()
		#self.fileMenu.AppendMenu(wx.NewId(), "&Recent Profile Files", profileHistoryMenu)
		#self.profileFileHistory.UseMenu(profileHistoryMenu)
		#self.profileFileHistory.AddFilesToMenu()
		#self.Bind(wx.EVT_MENU_RANGE, self.OnProfileMRU, id=self.ID_MRU_PROFILE1, id2=self.ID_MRU_PROFILE10)
		
		self.fileMenu.AppendSeparator()
		i = self.fileMenu.Append(wx.ID_EXIT, _('Quit'))
		self.Bind(wx.EVT_MENU, self.OnQuit, i)
		self.menubar.Append(self.fileMenu, _('&File'))

		#toolsMenu = wx.Menu()
		#i = toolsMenu.Append(-1, 'Switch to quickprint...')
		#self.switchToQuickprintMenuItem = i
		#self.Bind(wx.EVT_MENU, self.OnSimpleSwitch, i)
		#i = toolsMenu.Append(-1, 'Switch to full settings...')
		#self.switchToNormalMenuItem = i
		#self.Bind(wx.EVT_MENU, self.OnNormalSwitch, i)
		#toolsMenu.AppendSeparator()
		#i = toolsMenu.Append(-1, 'Batch run...')
		#self.Bind(wx.EVT_MENU, self.OnBatchRun, i)
		#self.normalModeOnlyItems.append(i)
		#if minecraftImport.hasMinecraft():
		#	i = toolsMenu.Append(-1, 'Minecraft import...')
		#	self.Bind(wx.EVT_MENU, self.OnMinecraftImport, i)
		#self.menubar.Append(toolsMenu, 'Tools')

		expertMenu = wx.Menu()
		if version.isDevVersion():
			i = expertMenu.Append(-1, _('Open expert settings...'))
			self.normalModeOnlyItems.append(i)
			self.Bind(wx.EVT_MENU, self.OnExpertOpen, i)
			expertMenu.AppendSeparator()

		if firmwareInstall.getDefaultFirmware() is not None:
			i = expertMenu.Append(-1, 'Install default Marlin firmware')
			self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i)
		i = expertMenu.Append(-1, _('Install custom firmware'))
		self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i)
		#expertMenu.AppendSeparator()
		#i = expertMenu.Append(-1, 'Run first run wizard...')
		#self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i)
		#i = expertMenu.Append(-1, 'Run bed leveling wizard...')
		#self.Bind(wx.EVT_MENU, self.OnBedLevelWizard, i)
		#if self.extruderCount > 1:
		#	i = expertMenu.Append(-1, 'Run head offset wizard...')
		#	self.Bind(wx.EVT_MENU, self.OnHeadOffsetWizard, i)
		self.menubar.Append(expertMenu, 'Advanced') #DEBUG

		helpMenu = wx.Menu()
		#i = helpMenu.Append(-1, 'Online documentation...')
		#self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('http://daid.github.com/Cura'), i)
		#i = helpMenu.Append(-1, 'Report a problem...')
		#self.Bind(wx.EVT_MENU, lambda e: webbrowser.open('https://github.com/daid/Cura/issues'), i)sdf
		#i = helpMenu.Append(-1, 'Check for update...')
		#self.Bind(wx.EVT_MENU, self.OnCheckForUpdate, i)
		i = helpMenu.Append(-1, _('About Tinkerine Suite'))
		self.Bind(wx.EVT_MENU, self.OnAbout, i)
		self.menubar.Append(helpMenu, _('About'))
		self.SetMenuBar(self.menubar)
        

		self.splitter = wx.SplitterWindow(self, style = wx.SP_3D | wx.SP_LIVE_UPDATE)
		#self.splitter2 = wx.SplitterWindow(self.splitter, style = wx.SP_3D | wx.SP_LIVE_UPDATE)

        
		#self.leftPane = wx.Panel(self.splitter2, style=wx.BORDER_NONE)
		self.rightPane = wx.Panel(self, style=wx.BORDER_NONE)
		#self.splitter.Bind(wx.EVT_SPLITTER_DCLICK, lambda evt: evt.Veto())

		# wx.BeginBusyCursor()



		# self.rightPane.SetCursor(self.defaultCursor)
		##Gui components##
		#self.simpleSettingsPanel = simpleMode.simpleModePanel(self.leftPane, lambda : self.scene.sceneUpdated())
		self.normalSettingsPanel = normalSettingsPanel(self, lambda : self.scene.sceneUpdated())
		#self.abuttonthing = wx.Button(self.splitter2,2,"<", size=(15,100))
		#self.abuttonthing.Bind(wx.EVT_BUTTON,self.changeMode)
		#self.abuttonthing = wx.Button(self.splitter2,2,">")

		
		self.leftSizer = wx.BoxSizer(wx.HORIZONTAL)
		#self.leftSizer.Add(self.abuttonthing,1)
		#self.leftSizer.Add(self.simpleSettingsPanel)
		self.leftSizer.Add(self.normalSettingsPanel, 1, wx.EXPAND)
		#self.leftPane.SetSizer(self.leftSizer)
        
		#self.splitter2.SplitVertically(self.abuttonthing, self.leftPane)
		#self.splitter2.SetSashGravity(0)
		#self.splitter2.SetSashPosition(10, True)
        
		#Preview window
		self.scene = sceneView.SceneView(self.rightPane)

		#Main sizer, to position the preview window, buttons and tab control
		sizer = wx.BoxSizer()
		self.rightPane.SetSizer(sizer)
		sizer.Add(self.scene, 1, flag=wx.EXPAND)

		# Main window sizer
		sizer = wx.BoxSizer(wx.VERTICAL)
		self.SetSizer(sizer)
		sizer.Add(self.rightPane, 1, wx.EXPAND)
		sizer.Layout()
		self.sizer = sizer

		#self.updateProfileToControls()

		self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour())

		#self.simpleSettingsPanel.Show(False)
		self.normalSettingsPanel.Show(False)

		# Set default window size & position
		self.SetSize((wx.Display().GetClientArea().GetWidth()/2,wx.Display().GetClientArea().GetHeight()/2))
		self.Centre()
		#self.splitter.SetSashGravity(1)
		# Restore the window position, size & state from the preferences file
		try:
			if profile.getPreference('window_maximized') == 'True':
				self.Maximize(True)
			else:
				posx = int(profile.getPreference('window_pos_x'))
				posy = int(profile.getPreference('window_pos_y'))
				width = int(profile.getPreference('window_width'))
				height = int(profile.getPreference('window_height'))
				if posx > 0 or posy > 0:
					self.SetPosition((posx,posy))
				if width > 0 and height > 0:
					self.SetSize((width,height))
				
			self.normalSashPos = int(profile.getPreference('window_normal_sash'))
		except:
			self.normalSashPos = 0
			self.Maximize(True)
		#if self.normalSashPos < self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5:
		#	self.normalSashPos = self.normalSettingsPanel.printPanel.GetBestSize()[0] + 5

		#self.splitter.SplitVertically(self.rightPane, self.splitter2, self.normalSashPos)

		if wx.Display.GetFromPoint(self.GetPosition()) < 0:
			self.Centre()
		if wx.Display.GetFromPoint((self.GetPositionTuple()[0] + self.GetSizeTuple()[1], self.GetPositionTuple()[1] + self.GetSizeTuple()[1])) < 0:
			self.Centre()
		if wx.Display.GetFromPoint(self.GetPosition()) < 0:
			self.SetSize((800,600))
			self.Centre()

		self.updateSliceMode()
Пример #51
0
    def __init__(self, parent, printerConnection):
        super(printWindowBasic, self).__init__(
            parent,
            -1,
            style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX
            | wx.FRAME_FLOAT_ON_PARENT,
            title=_("Printing on %s") % (printerConnection.getName()))
        self._parent = parent

        frameicon = wx.Icon(resources.getPathForImage('cura.ico'),
                            wx.BITMAP_TYPE_ICO)
        self.SetIcon(frameicon)

        self._printerConnection = printerConnection
        self._lastUpdateTime = 0

        panel = wx.Panel(self)

        self.powerWarningText = wx.StaticText(
            parent=panel,
            id=-1,
            label=
            _("Your computer is maybe running on battery power.\nPlease check that your computer is connected to AC power or your print might not finish."
              ),
            style=wx.ALIGN_CENTER)
        self.powerWarningText.SetForegroundColour((169, 68, 66))

        self.statusText = wx.StaticText(panel, -1)
        statusFont = self.statusText.GetFont()
        statusFont.SetStyle(wx.FONTSTYLE_ITALIC)
        self.statusText.SetFont(statusFont)

        self.noozleTemperatureText = wx.StaticText(panel, -1)
        self.bedTemperatureText = wx.StaticText(panel, -1)

        self.printButton = wx.Button(panel, -1, _("Print"))
        self.pauseButton = wx.Button(panel, -1, _("Pause"))
        self.cancelButton = wx.Button(panel, -1, _("Cancel print"))
        self.logButton = wx.Button(panel, -1, _("Log"))

        buttonsSizer = wx.BoxSizer(wx.HORIZONTAL)
        buttonsSizer.Add(self.printButton)
        buttonsSizer.Add(self.pauseButton)
        buttonsSizer.Add(self.cancelButton)
        buttonsSizer.Add(self.logButton)

        self.progress = wx.Gauge(panel, -1, range=1000)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.powerWarningText, flag=wx.BOTTOM, border=5)
        sizer.Add(self.statusText, flag=wx.BOTTOM, border=5)
        sizer.Add(self.noozleTemperatureText)
        sizer.Add(self.bedTemperatureText, flag=wx.BOTTOM, border=5)
        sizer.Add(buttonsSizer)
        sizer.Add(self.progress, flag=wx.EXPAND)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
        self.pauseButton.Bind(wx.EVT_BUTTON, self.OnPause)
        self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
        self.logButton.Bind(wx.EVT_BUTTON, self.OnErrorLog)

        panel.SetSizerAndFit(sizer)
        panel.Layout()
        self.Fit()
        self.Centre()

        self._updateButtonStates()

        self._printerConnection.addCallback(self._doPrinterConnectionUpdate)

        if self._printerConnection.hasActiveConnection(
        ) and not self._printerConnection.isActiveConnectionOpen():
            self._printerConnection.openActiveConnection()
        preventComputerFromSleeping(True)