当前位置: 首页>>代码示例>>Python>>正文


Python Job.material方法代码示例

本文整理汇总了Python中job.Job.material方法的典型用法代码示例。如果您正苦于以下问题:Python Job.material方法的具体用法?Python Job.material怎么用?Python Job.material使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在job.Job的用法示例。


在下文中一共展示了Job.material方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_job

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import material [as 别名]
 def create_job(self,filename,**kwargs):
     """Create a job and try to set the source. Returns bool success."""
     job = Job(**kwargs)
     # Get the default material
     job.material = self.get_material()
     try:
         job.set_source(filename)
         self.job = job
         self.session.add(self.job)
         msg = 'Loaded %s'%os.path.basename(job.name or 'File')
         self.get_window('inkcut').set_title("*%s - Inkcut"%job.name)
         self.flash(msg)
         self.on_plot_feed_distance_changed(self.get_widget('plot-properties','plot-feed'))
         self._update_ui()
         return False
     except Exception, err:
         # update the ui with job info
         log.debug(traceback.format_exc())
         msg = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
             buttons=Gtk.ButtonsType.OK,
             message_format="Issue loading file")
         msg.format_secondary_text(err)
         msg.run()
         msg.destroy()
         return False
开发者ID:pc-coholic,项目名称:Inkcut,代码行数:27,代码来源:inkcut.py

示例2: load

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import material [as 别名]
 def load(self,source=None,source_filename=None,selected_nodes=None):
     # Check if similar job exists
     jobs = self.session.query(Job).filter(Job.source_filename == unicode(source_filename)).all()
     if len(jobs)==0:
         job = Job(source=source,source_filename=source_filename,selected_nodes=selected_nodes)
         job.material = self.session.query(Material).first()
         if job.load():
             # update the ui with job info
             self.job = job
             self._flash(0,'%s loaded'%os.path.basename(job.source_filename or 'File'))
             self._update_preview()
             return True
         else:
             msg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
                 buttons=gtk.BUTTONS_CLOSE,
                 message_format=job.messages.pop())
             msg.set_title('Error opening file')
             msg.run()
             msg.destroy()
             return False
     else:
         # open a new job or
         msg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
             buttons=gtk.BUTTONS_CLOSE,
             message_format='A similar job was already found, do you want to load that?')
         msg.set_title('File Already Found opening file')
         msg.run()
         msg.destroy()
         return False
开发者ID:pc-coholic,项目名称:Inkcut,代码行数:31,代码来源:inkcut.py


注:本文中的job.Job.material方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。