本文整理汇总了Python中api.configuration_api.ConfigurationAPI.load_printer方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationAPI.load_printer方法的具体用法?Python ConfigurationAPI.load_printer怎么用?Python ConfigurationAPI.load_printer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.configuration_api.ConfigurationAPI
的用法示例。
在下文中一共展示了ConfigurationAPI.load_printer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_cure_test_returns_a_layer_generator
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_cure_test_returns_a_layer_generator(self, mock_load):
mock_load.return_value = self.DEFAULT_CONFIG
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
cure_test = configuration_API.get_cure_test(0,1,1,2)
cure_test.next()
示例2: SetupUI
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
class SetupUI(PeachyFrame):
def initialize(self):
self._configuration_api = ConfigurationAPI(self._configuration_manager)
self.grid()
printer_selection_current = StringVar()
if not self._configuration_api.get_available_printers():
self._configuration_api.add_printer("Peachy Printer")
available_printers = self._configuration_api.get_available_printers()
printer_selection_current.set(available_printers[0])
self._printer_selected(available_printers[0])
printer_selection_menu = OptionMenu(
self,
printer_selection_current,
*available_printers,
command = self._printer_selected)
printer_selection_menu.grid(column=1,row=10,sticky=NSEW)
Button(self,text=u"Add Printer", command=self._add_printer).grid(column=2,row=10,sticky=NSEW)
Label(self).grid(column=0,row=15)
Button(self,text=u"Setup Audio", command=self._setup_audio).grid(column=1,row=20,sticky=NSEW)
Button(self,text=u"Setup Options", command=self._setup_options).grid(column=1,row=30,sticky=NSEW)
Button(self,text=u"Setup Drip Calibration", command=self._drip_calibration).grid(column=1,row=40,sticky=NSEW)
Button(self,text=u"Setup Calibration", command=self._calibration).grid(column=1,row=50,sticky=NSEW)
Button(self,text=u"Run Cure Test", command=self._cure_test).grid(column=1,row=60,sticky=NSEW)
Label(self).grid(column=0,row=70)
Button(self,text=u"Back", command=self._back).grid(column=0,row=100)
self.grid_columnconfigure(1,weight=1)
self.update()
def _printer_selected(self, selection):
self._configuration_api.load_printer(selection)
self._current_printer = selection
def _add_printer(self):
self.navigate(AddPrinterUI)
def _setup_options(self):
self.navigate(SetupOptionsUI, printer = self._current_printer)
def _drip_calibration(self):
self.navigate(DripCalibrationUI, printer = self._current_printer)
def _back(self):
self.navigate(MainUI, printer = self._current_printer)
def _setup_audio(self):
self.navigate(SetupAudioUI, printer = self._current_printer)
def _calibration(self):
self.navigate(CalibrationUI, printer = self._current_printer)
def _cure_test(self):
self.navigate(CureTestUI, printer = self._current_printer)
def close(self):
pass
示例3: test_get_serial_options_loads_correctly
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_serial_options_loads_correctly(self, mock_save, mock_load):
expected_enabled = True
expected_port = 'com54'
expected_on = 'GOGOGO'
expected_off = 'STOPSTOP'
mock_load.return_value = self.default_config
expected = self.default_config
expected.serial.on = expected_enabled
expected.serial.port = expected_port
expected.serial.on_command = expected_on
expected.serial.off_command = expected_off
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
configuration_API.set_serial_enabled(expected_enabled)
configuration_API.set_serial_port(expected_port)
configuration_API.set_serial_on_command(expected_on)
configuration_API.set_serial_off_command(expected_off)
self.assertEquals( expected_enabled ,configuration_API.get_serial_enabled())
self.assertEquals( expected_port ,configuration_API.get_serial_port())
self.assertEquals( expected_on ,configuration_API.get_serial_on_command())
self.assertEquals( expected_off ,configuration_API.get_serial_off_command())
self.assertConfigurationEqual(expected, mock_save.mock_calls[0][1][0])
示例4: test_get_speed_at_height_values_must_be_positive_non_0_numbers_for_all_but_base
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_speed_at_height_values_must_be_positive_non_0_numbers_for_all_but_base(self, mock_load):
mock_load.return_value = self.DEFAULT_CONFIG
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
with self.assertRaises(Exception):
configuration_API.get_speed_at_height('a',10,10,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,'a',10,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,'a',1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,'a',1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,1,'a',1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(-1,10,10,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,-10,10,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,-1,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,-1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,1,-1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,0,10,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,0,1,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,0,1)
with self.assertRaises(Exception):
configuration_API.get_speed_at_height(1,10,10,1,0,1)
示例5: test_get_speed_at_height_returns_a_correct_height
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_speed_at_height_returns_a_correct_height(self, mock_load):
mock_load.return_value = self.DEFAULT_CONFIG
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
speed = configuration_API.get_speed_at_height(0,1,10,20,0.5)
self.assertEquals(15, speed)
示例6: test_sublayer_height_mm_returns_theight
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_sublayer_height_mm_returns_theight(self, mock_load):
expected = 7.0
mock_load.return_value = { 'name':'name', 'sublayer_height_mm': expected }
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
self.assertEquals(expected,configuration_API.get_sublayer_height_mm())
示例7: test_get_available_audio_options_sets_currently_selected
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_available_audio_options_sets_currently_selected(self, mock_load, mock_get_valid_sampling_options):
audio_options = {
"input" : [{'sample_rate' : 48000, 'depth': '16 bit' },{'sample_rate' : 44100, 'depth': '16 bit' }],
"output": [{'sample_rate' : 48000, 'depth': '16 bit' },{'sample_rate' : 44100, 'depth': '16 bit' }]
}
mock_get_valid_sampling_options.return_value = audio_options
config = self.DEFAULT_CONFIG.copy()
config['input_bit_depth'] = '16 bit'
config['input_sample_frequency'] = 44100
config['output_bit_depth'] = '16 bit'
config['output_sample_frequency'] = 44100
mock_load.return_value = config
capi = ConfigurationAPI(ConfigurationManager())
capi.load_printer("Printer")
actual = capi.get_available_audio_options()
in1 = AudioSetting(44100,'16 bit', current = True)
in2 = AudioSetting(48000,'16 bit', recommended = True)
out1 = AudioSetting(44100,'16 bit', current = True)
out2 = AudioSetting(48000,'16 bit', recommended = True)
self.assertListContentsEqual([in1, in2],actual['inputs'])
self.assertListContentsEqual([out1, out2],actual['outputs'])
示例8: test_get_cure_test_values_must_be_positive_non_0_numbers_for_all_but_base
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_cure_test_values_must_be_positive_non_0_numbers_for_all_but_base(self, mock_load):
mock_load.return_value = self.default_config
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
with self.assertRaises(Exception):
configuration_API.get_cure_test('a',10,10,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,'a',10,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,'a',1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,'a')
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,1,'a')
with self.assertRaises(Exception):
configuration_API.get_cure_test(-1,10,10,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,-10,10,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,-1,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,-1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,1,-1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,0,10,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,0,1)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,0)
with self.assertRaises(Exception):
configuration_API.get_cure_test(1,10,10,1,0)
示例9: test_get_available_audio_options_should_include_recomended_options
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_available_audio_options_should_include_recomended_options(self, mock_load, mock_get_valid_sampling_options):
audio_options = {
"input" : [{'sample_rate' : 48000, 'depth': '16 bit' }],
"output": [{'sample_rate' : 48000, 'depth': '16 bit' }]
}
expected_in = AudioSetting(48000,'16 bit', current = True)
expected_in.set_recommended()
expected_out = AudioSetting(48000,'16 bit', current = True)
expected_out.set_recommended()
expected = {
"inputs" : [expected_in],
"outputs": [expected_out]
}
mock_get_valid_sampling_options.return_value = audio_options
mock_load.return_value = self.DEFAULT_CONFIG
capi = ConfigurationAPI(ConfigurationManager())
capi.load_printer("Printer")
actual = capi.get_available_audio_options()
self.assertListContentsEqual(expected['inputs'],actual['inputs'])
self.assertListContentsEqual(expected['outputs'],actual['outputs'])
示例10: test_load_printer_calls_load
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_load_printer_calls_load(self, mock_load):
printer_name = 'MegaPrint'
mock_load.return_value = { 'name':printer_name}
capi = ConfigurationAPI(ConfigurationManager())
capi.load_printer(printer_name)
mock_load.assert_called_with(printer_name)
示例11: test_get_dripper_type_should_return_current_type
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_dripper_type_should_return_current_type(self, mock_load):
configuration_API = ConfigurationAPI(ConfigurationManager())
mock_load.return_value = self.default_config
configuration_API.load_printer('Printer')
actual = configuration_API.get_dripper_type()
self.assertEquals(self.default_config.dripper.dripper_type, actual)
示例12: test_start_counting_drips_should_start_getting_drips
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_start_counting_drips_should_start_getting_drips(self, mock_start,mock_load,mock_save):
configuration_API = ConfigurationAPI(ConfigurationManager())
mock_load.return_value = self.DEFAULT_CONFIG
configuration_API.load_printer('printer')
configuration_API.start_counting_drips()
mock_start.assert_called_with()
示例13: test_get_emulated_drips_per_second_should_return
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_emulated_drips_per_second_should_return(self, mock_load):
configuration_API = ConfigurationAPI(ConfigurationManager())
mock_load.return_value = self.default_config
configuration_API.load_printer('Printer')
actual = configuration_API.get_emulated_drips_per_second()
self.assertEquals(self.default_config.dripper.emulated_drips_per_second, actual)
示例14: test_get_laser_thickness_mm_returns_thickness
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [as 别名]
def test_get_laser_thickness_mm_returns_thickness(self, mock_load):
expected = 7.0
config = self.DEFAULT_CONFIG.copy()
config['laser_thickness_mm'] = expected
mock_load.return_value = config
configuration_API = ConfigurationAPI(ConfigurationManager())
configuration_API.load_printer("test")
self.assertEquals(expected,configuration_API.get_laser_thickness_mm())
示例15: test_get_max_lead_distance_mm_returns_max_lead_distance
# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import load_printer [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())