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


Python Main.abort_session方法代码示例

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


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

示例1: get_image

# 需要导入模块: import Main [as 别名]
# 或者: from Main import abort_session [as 别名]
 def get_image(self):
     """
     Prompts the Ximea camera to capture a photo after the next GPI spike.
     """
     try:
         self.camera.get_image(self.image)
         return self.image.get_image_data_numpy()
     except xiapi.Xi_error:
         Interface.choose_print(self.gui, 'camera', 'Xi_error: ERROR 10: Timeout')
         Main.abort_session()
         return None
开发者ID:GhoulPoP,项目名称:ProjectScarberry,代码行数:13,代码来源:XimeaController.py

示例2: write_value

# 需要导入模块: import Main [as 别名]
# 或者: from Main import abort_session [as 别名]
 def write_value(self,value):
     """
     Write a value to the Arduino over Serial.
         :argument value: Value to be written to Arduino
         :type value: string, int, float
         :argument pause: Amount of time spent paused in seconds
         :type pause: int, float
     """
     Interface.choose_print(self.gui, 'arduino', 'Writing "{}"...'.format(value))
     try:
         self.serial.write('{}'.format(value))
         self.serial.readline()
         Interface.choose_print(self.gui, 'arduino', 'Wrote: {}'.format(value))
     except serial.SerialException:
         Interface.choose_print(self.gui,
                                'arduino',
                                'SerialException: WriteFile failed')
         Main.abort_session()
开发者ID:GhoulPoP,项目名称:ProjectScarberry,代码行数:20,代码来源:ArduinoController.py

示例3: __init__

# 需要导入模块: import Main [as 别名]
# 或者: from Main import abort_session [as 别名]
 def __init__(self,com_number,gui=None):
     """
     Initializes an instance of ArduinoController.
         :argument com_number: Port number of the Arduino.
         :type com_number: int
         :keyword gui: Optional interface used to print(default None).
         :type gui: Interface.ScarberryGui
     """
     self.gui = gui
     try:
         self.serial = serial.Serial('COM{}'.format(com_number),115200)
         Interface.choose_print(gui, 'arduino', 'Waiting for COM{}...'.format(com_number))
         print('Waiting for COM{}...'.format(com_number))
         time.sleep(ArduinoController.INITIAL_SLEEP);
         Interface.choose_print(gui, 'arduino', 'Connected to COM{}.'.format(com_number))
         print('Connected to COM{}.'.format(com_number))
     except serial.SerialException:
         Interface.choose_print(self.gui,
                                'arduino',
                                'SerialException: could not open COM{}'.format(com_number))
         Main.abort_session()
开发者ID:GhoulPoP,项目名称:ProjectScarberry,代码行数:23,代码来源:ArduinoController.py

示例4: __init__

# 需要导入模块: import Main [as 别名]
# 或者: from Main import abort_session [as 别名]
    def __init__(self,framerate,gain=0,gui=None):
        """
        Initializes an instance of XimeaCamera.
            :argument framerate: Number of pictures taken a second.
            :type framerate: int
            :keyword gain: Brightness modifier of pictures taken.
            type gain: int, float [0 to 6](default 0)
            :keyword gui: Optional interface used to print(default None).
            :type gui: Interface.ScarberryGui
        """
        self.gui = gui
        self.image = xiapi.Image()

        self.camera = xiapi.Camera()
        Interface.choose_print(gui, 'camera', 'Opening camera...')
        try:
            self.camera.open_device()

            exposure = (1000000 / (int(framerate)))
            exposure -= math.pow(10, math.floor(math.log(exposure, 10)) - 1)
            self.camera.set_exposure(int(exposure))

            if gain < 0:
                gain = 0
            if gain > 6:
                gain = 6
            self.camera.set_gain(float(gain))

            self.camera.set_trigger_source('XI_TRG_EDGE_RISING')
            self.camera.set_gpi_mode('XI_GPI_TRIGGER')
            self.camera.set_gpo_selector('XI_GPO_PORT1')
            self.camera.set_gpo_mode('XI_GPO_FRAME_TRIGGER_WAIT')
            self.camera.set_imgdataformat('XI_MONO8')
        except xiapi.Xi_error:
            Interface.choose_print(gui, 'camera', 'Xi_error: ERROR 56: No Devices Found')
            Main.abort_session()
开发者ID:GhoulPoP,项目名称:ProjectScarberry,代码行数:38,代码来源:XimeaController.py


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