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


Python ConfigurationAPI.get_speed_at_height方法代码示例

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


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

示例1: test_get_speed_at_height_must_have_height_between_total_and_base

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_speed_at_height [as 别名]
    def test_get_speed_at_height_must_have_height_between_total_and_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(0,10,1,2,11)
        with self.assertRaises(Exception):
            configuration_API.get_speed_at_height(2,10,1,2,0)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:11,代码来源:configuration_api_test.py

示例2: test_get_speed_at_height_must_exceed_base_height

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_speed_at_height [as 别名]
    def test_get_speed_at_height_must_exceed_base_height(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(10,1,1,2,1)
        with self.assertRaises(Exception):
            configuration_API.get_speed_at_height(1,1,1,2,1)
开发者ID:superblobmonster,项目名称:peachyprintertools,代码行数:11,代码来源:configuration_api_test.py

示例3: test_get_speed_at_height_final_speed_exceeds_start_speed

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_speed_at_height [as 别名]
    def test_get_speed_at_height_final_speed_exceeds_start_speed(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(1,10,10,1,1)

        with self.assertRaises(Exception):
            configuration_API.get_speed_at_height(1,10,1,1,1)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:12,代码来源:configuration_api_test.py

示例4: test_get_speed_at_height_returns_a_correct_height

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_speed_at_height [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)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:9,代码来源:configuration_api_test.py

示例5: 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 get_speed_at_height [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)
开发者ID:colehard,项目名称:peachyprintertools,代码行数:35,代码来源:configuration_api_test.py

示例6: CureTestUI

# 需要导入模块: from api.configuration_api import ConfigurationAPI [as 别名]
# 或者: from api.configuration_api.ConfigurationAPI import get_speed_at_height [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.get_speed_at_height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。