def OnGenerate(self, event): logger.info('Generating files') output = self.resultFilePicker.GetPath() logger.info('Output file: ' + output) g_files = [] z_values = [] t_files = [] for c in self.m_scrolledWindow.GetSizer().GetChildren(): pass # TODO: implement scan over panels # TODO: make sure this is independent of order widget = c.GetWindow() if type(widget) is GCodePanel: logger.info('Found GCode panel ' + widget.title.GetLabel()) path = widget.filePicker.GetPath() if path: logger.debug('path: ' + path + '.') g_files.append(path) zval = widget.z_to.GetValue() if path and zval: logger.info('Found Z value') logger.debug(zval) z_values.append(float(zval)) elif type(widget) is TransitionPanel: logger.info('Found transition panel ' + widget.title.GetLabel()) path = widget.filePicker.GetPath() if path and widget.useTransition_checkbox.IsChecked(): logger.debug('path: ' + path + '.') t_files.append(path) logger.info(g_files) logger.info(z_values) logger.info(t_files) if splicer.splice_files(output, g_files, z_values, t_files) is not 0: logger.error('An error occurred during splicing!') logger.info('Finished splicing!')
def OnGenerate( self, event ): logger.info('Generating files') output=self.resultFilePicker.GetPath() logger.info('Output file: ' + output) g_files=[] z_values=[] t_files=[] for c in self.m_scrolledWindow.GetSizer().GetChildren(): pass # TODO: implement scan over panels # TODO: make sure this is independent of order widget = c.GetWindow() if type(widget) is GCodePanel: logger.info('Found GCode panel ' + widget.title.GetLabel()) path=widget.filePicker.GetPath() if path: logger.debug('path: ' + path + '.') g_files.append(path) zval=widget.z_to.GetValue() if path and zval: logger.info('Found Z value') logger.debug(zval) z_values.append(float(zval)) elif type(widget) is TransitionPanel: logger.info('Found transition panel ' + widget.title.GetLabel()) path=widget.filePicker.GetPath() if path and widget.useTransition_checkbox.IsChecked(): logger.debug('path: ' + path +'.') t_files.append(path) logger.info(g_files) logger.info(z_values) logger.info(t_files) if splicer.splice_files(output, g_files, z_values, t_files) is not 0: logger.error('An error occurred during splicing!') logger.info('Finished splicing!')
if len(args.transitionfiles) not in [0, 1, (len(args.files) - 1)]: parser.error( 'There may be either one transition file or one fewer than files') # Initialisation if args.verbose is True: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig( level=logging.INFO) # DEBUG/INFO/WARNING/ERROR/CRITICAL logger.debug(args) #Main function logger.info('Start splicing process.') if splicer.splice_files(args.output, args.files, args.zvalues, args.transitionfiles) is not 0: logger.error('An error occurred during splicing!') logger.info('Finished!') #Cleanup logging.shutdown() else: # No arguments have been passed. Start in GUI mode logging.basicConfig(level=logging.INFO) app = wx.App( False) # Create a new app, don't redirect stdout/stderr to a window. # frame = wx.Frame(None, wx.ID_ANY, "G-code Z Splicer") # A Frame is a top-level window. frame = splicer_GUI.MyFrame(None) frame.Show(True) # Show the frame.
if len(args.files) is not (len(args.zvalues)+1): parser.error('there must be one fewer zvalues than files') if len(args.transitionfiles) not in [0,1,(len(args.files)-1)]: parser.error('There may be either one transition file or one fewer than files') # Initialisation if args.verbose is True: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) # DEBUG/INFO/WARNING/ERROR/CRITICAL logger.debug(args) #Main function logger.info('Start splicing process.') if splicer.splice_files(args.output, args.files, args.zvalues, args.transitionfiles) is not 0: logger.error('An error occurred during splicing!') logger.info('Finished!') #Cleanup logging.shutdown() else: # No arguments have been passed. Start in GUI mode logging.basicConfig(level=logging.INFO) app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window. # frame = wx.Frame(None, wx.ID_ANY, "G-code Z Splicer") # A Frame is a top-level window. frame = splicer_GUI.MyFrame(None) frame.Show(True) # Show the frame. app.MainLoop()