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


Python ConfigurationAPI.set_speed方法代码示例

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


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

示例1: test_set_speed

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_speed [as 别名]
 def test_set_speed(self, mock_save, mock_load):
     mock_load.return_value = self.DEFAULT_CONFIG.copy()
     expected_config = self.DEFAULT_CONFIG.copy()
     expected_config['draw_speed'] = 121.0
     configuration_API = ConfigurationAPI(ConfigurationManager())
     configuration_API.load_printer("test")
     
     configuration_API.set_speed(121)
     
     mock_save.assert_called_with(expected_config)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:12,代码来源:configuration_api_test.py

示例2: test_set_speed

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_speed [as 别名]
 def test_set_speed(self, mock_save, mock_load):
     mock_load.return_value = self.default_config
     expected = self.default_config
     expected.options.draw_speed = 121.0
     configuration_API = ConfigurationAPI(ConfigurationManager())
     configuration_API.load_printer("test")
     
     configuration_API.set_speed(121)
     
     self.assertConfigurationEqual(expected, mock_save.mock_calls[0][1][0])
开发者ID:superblobmonster,项目名称:peachyprintertools,代码行数:12,代码来源:configuration_api_test.py

示例3: test_set_speed_should_throw_exception_if_less_then_or_0

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_speed [as 别名]
 def test_set_speed_should_throw_exception_if_less_then_or_0(self, mock_save, mock_load):
     mock_load.return_value = self.DEFAULT_CONFIG.copy()
     expected_config = self.DEFAULT_CONFIG.copy()
     expected_config['draw_speed'] = 121.0
     configuration_API = ConfigurationAPI(ConfigurationManager())
     configuration_API.load_printer("test")
     
     with self.assertRaises(Exception):
         configuration_API.set_speed(-1)
     with self.assertRaises(Exception):
         configuration_API.set_speed(0)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:13,代码来源:configuration_api_test.py

示例4: test_set_speed_should_throw_exception_if_less_then_or_0

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_speed [as 别名]
 def test_set_speed_should_throw_exception_if_less_then_or_0(self, mock_save, mock_load):
     mock_load.return_value = self.default_config
     expected_config = self.default_config
     expected_config.options.draw_speed = 121.0
     configuration_API = ConfigurationAPI(ConfigurationManager())
     configuration_API.load_printer("test")
     
     with self.assertRaises(Exception):
         configuration_API.set_speed(-1)
     with self.assertRaises(Exception):
         configuration_API.set_speed(0)
开发者ID:superblobmonster,项目名称:peachyprintertools,代码行数:13,代码来源:configuration_api_test.py

示例5: CureTestUI

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import set_speed [as 别名]
class CureTestUI(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._base_height = IntVar()
        self._base_height.set(3)
        self._total_height = IntVar()
        self._total_height.set(23)
        self._start_speed = IntVar()
        self._start_speed.set(50)
        self._stop_speed = IntVar()
        self._stop_speed.set(250)
        self._best_height = IntVar()
        self._best_height.set(0)

        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 = "Base Height (mm)" ).grid(column=0,row=20)
        Entry(self, textvariable = self._base_height).grid(column=1, row=20)

        Label(self, text = "Total Height (mm)" ).grid(column=0,row=30)
        Entry(self, textvariable = self._total_height).grid(column=1, row=30)

        Label(self, text = "Start Speed (mm)" ).grid(column=0,row=40)
        Entry(self, textvariable = self._start_speed).grid(column=1, row=40)

        Label(self, text = "Finish Speed (mm)" ).grid(column=0,row=50)
        Entry(self, textvariable = self._stop_speed).grid(column=1, row=50)
        Label(self).grid(column=1,row=60)

        Button(self, text ="Run Test", command = self._start).grid(column=2,row=70,sticky=N+S+E)

        Label(self).grid(column=1,row=80)

        Label(self, text = "Best height above base (mm)" ).grid(column=0,row=90)
        self._best_height_field = Entry(self, textvariable = self._best_height)
        self._best_height_field.grid(column=1, row=90)
        
        Label(self).grid(column=1,row=100)

        Button(self, text ="Save", command = self._save).grid(column=2,row=110,sticky=N+S+W)
        Button(self, text ="Back", command = self._back).grid(column=0,row=110,sticky=N+S+W)

        self.update()

    def _back(self):
        self.navigate(SetupUI)

    def _help(self):
        PopUp(self,'Help', help_text.cure_test_help)

    def _save(self):
        try:
            speed = self._configuration_api.get_speed_at_height(
                    self._base_height.get(),
                    self._total_height.get(),
                    self._start_speed.get(),
                    self._stop_speed.get(),
                    self._best_height.get()
                    )
            self._configuration_api.set_speed(speed)
            self.navigate(SetupUI)
        except Exception as ex:
            tkMessageBox.showwarning("Error", ex.message)

    def _start(self):
        try:
            cure_test = self._configuration_api.get_cure_test(
                self._base_height.get(),
                self._total_height.get(),
                self._start_speed.get(),
                self._stop_speed.get()
                )
            self.navigate(PrintStatusUI,layer_generator = cure_test, config = self._configuration_api.get_current_config(), calling_class = CureTestUI, printer = self._current_printer)
        except Exception as ex:
            tkMessageBox.showwarning("Error", ex.message)

    def close(self):
        pass
开发者ID:superblobmonster,项目名称:peachyprintertools,代码行数:89,代码来源:configuration_ui.py


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