本文整理汇总了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
示例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