本文整理汇总了Python中api.configuration_api.ConfigurationAPI.get_max_lead_distance_mm方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationAPI.get_max_lead_distance_mm方法的具体用法?Python ConfigurationAPI.get_max_lead_distance_mm怎么用?Python ConfigurationAPI.get_max_lead_distance_mm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.configuration_api.ConfigurationAPI
的用法示例。
在下文中一共展示了ConfigurationAPI.get_max_lead_distance_mm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_max_lead_distance_mm_returns_max_lead_distance
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_max_lead_distance_mm [as 别名]
def test_get_max_lead_distance_mm_returns_max_lead_distance(self, mock_load):
expected = 0.4
config = self.DEFAULT_CONFIG.copy()
config['max_lead_distance_mm'] = expected
mock_load.return_value = config
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
self.assertEquals(expected,configuration_API.get_max_lead_distance_mm())
示例2: test_get_max_lead_distance_mm_returns_max_lead_distance
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_max_lead_distance_mm [as 别名]
def test_get_max_lead_distance_mm_returns_max_lead_distance(self, mock_load):
expected = 0.4
config = self.default_config
config.dripper.max_lead_distance_mm = expected
mock_load.return_value = config
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
self.assertEquals(expected,configuration_API.get_max_lead_distance_mm())
示例3: test_set_max_lead_distance_mm_sets_max_lead_distance_mm
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_max_lead_distance_mm [as 别名]
def test_set_max_lead_distance_mm_sets_max_lead_distance_mm(self, mock_save, mock_load):
expected = 0.4
expected_config = self.DEFAULT_CONFIG.copy()
expected_config['max_lead_distance_mm'] = expected
mock_load.return_value = self.DEFAULT_CONFIG.copy()
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
configuration_API.set_max_lead_distance_mm(expected)
self.assertEquals(expected,configuration_API.get_max_lead_distance_mm())
mock_save.assert_called_with(expected_config)
示例4: test_set_max_lead_distance_mm_sets_max_lead_distance_mm
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_max_lead_distance_mm [as 别名]
def test_set_max_lead_distance_mm_sets_max_lead_distance_mm(self, mock_save, mock_load):
expected = 0.4
expected_config = self.default_config
expected_config.dripper.max_lead_distance_mm = expected
mock_load.return_value = self.default_config
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
configuration_API.set_max_lead_distance_mm(expected)
self.assertEquals(expected,configuration_API.get_max_lead_distance_mm())
self.assertConfigurationEqual(expected_config, mock_save.mock_calls[0][1][0])
示例5: SetupOptionsUI
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_max_lead_distance_mm [as 别名]
class SetupOptionsUI(PeachyFrame):
def initialize(self):
self.grid()
self._current_printer = self.kwargs['printer']
self._configuration_api = ConfigurationAPI(self._configuration_manager)
self._configuration_api.load_printer(self._current_printer)
self.option_add('*Dialog.msg.width', 50)
self.laser_thickness_entry_text = DoubleVar()
self.laser_thickness_entry_text.set(self._configuration_api.get_laser_thickness_mm())
self.sublayer_height_entry_text = DoubleVar()
self.sublayer_height_entry_text.set(self._configuration_api.get_sublayer_height_mm())
self.max_lead_distance_entry_text = DoubleVar()
self.max_lead_distance_entry_text.set(self._configuration_api.get_max_lead_distance_mm())
Label(self, text = 'Printer: ').grid(column=0,row=10)
Label(self, text = self._configuration_api.current_printer()).grid(column=1,row=10)
Button(self, text='?', command=self._help).grid(column=2, row=10,stick=N+E)
Label(self).grid(column=1,row=15)
Label(self, text = "Spot Diameter (mm) [0.5]" ).grid(column=0,row=20)
Entry(self, textvariable = self.laser_thickness_entry_text).grid(column=1, row=20)
Label(self, text = "Sub Layer Height (mm) [0.05]" ).grid(column=0,row=30)
Entry(self, textvariable = self.sublayer_height_entry_text).grid(column=1, row=30)
Label(self, text = "Maximum Lead Distance (mm) [0.5]" ).grid(column=0,row=40)
Entry(self, textvariable = self.max_lead_distance_entry_text).grid(column=1, row=40)
Label(self).grid(column=1,row=50)
advanced_frame = LabelFrame(self, text="Advanced Options (use at your own risk)", padx=5, pady=5)
advanced_frame.grid(column=0,row=60, columnspan=3)
# ----------------------Frame Start---------------------------
self._use_serial = IntVar()
self._use_serial.set(self._configuration_api.get_serial_enabled())
self._serial_on_command = StringVar()
self._serial_on_command.set(self._configuration_api.get_serial_on_command())
self._serial_off_command = StringVar()
self._serial_off_command.set(self._configuration_api.get_serial_off_command())
self._serial_port = StringVar()
self._serial_port.set(self._configuration_api.get_serial_port())
Checkbutton(advanced_frame, text="Use Serial Drip Control", variable = self._use_serial, command=self._showhide_serial).grid(column=0, row = 10)
Label(advanced_frame,text="Serial Port").grid(column=0, row=20)
self._serial_port_entry = Entry(advanced_frame,textvariable=self._serial_port)
self._serial_port_entry.grid(column=1, row=20)
Label(advanced_frame,text="Serial On Command").grid(column=0, row=30)
self._serial_on_entry = Entry(advanced_frame,textvariable=self._serial_on_command)
self._serial_on_entry.grid(column=1, row=30)
Label(advanced_frame,text="Serial Off Command").grid(column=0, row=40)
self._serial_off_entry = Entry(advanced_frame,textvariable=self._serial_off_command)
self._serial_off_entry.grid(column=1, row=40)
self._showhide_serial()
# ----------------------Frame End---------------------------
Label(self).grid(column=1,row=70)
Button(self, text ="Back", command = self._back).grid(column=0,row=80,sticky=N+S+W)
Button(self, text ="Save", command = self._save).grid(column=2,row=80,sticky=N+S+E)
self.update()
def _showhide_serial(self):
if self._use_serial.get():
self._serial_off_entry.configure(state='normal')
self._serial_on_entry.configure(state='normal')
self._serial_port_entry.configure(state='normal')
else:
self._serial_off_entry.configure(state='disabled')
self._serial_on_entry.configure(state='disabled')
self._serial_port_entry.configure(state='disabled')
def _help(self):
PopUp(self,'Help', help_text.options_help)
def _back(self):
self.navigate(SetupUI)
def _save(self):
self._configuration_api.set_laser_thickness_mm(float(self.laser_thickness_entry_text.get()))
self._configuration_api.set_sublayer_height_mm(float(self.sublayer_height_entry_text.get()))
self._configuration_api.set_max_lead_distance_mm(float(self.max_lead_distance_entry_text.get()))
self._configuration_api.set_serial_enabled(bool(self._use_serial.get()))
self._configuration_api.set_serial_port(self._serial_port.get())
self._configuration_api.set_serial_on_command(self._serial_on_command.get())
self._configuration_api.set_serial_off_command(self._serial_off_command.get())
self.navigate(SetupUI)
def close(self):
pass