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


Python Thread.cancel方法代码示例

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


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

示例1: LUCKY7

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import cancel [as 别名]

#.........这里部分代码省略.........
                    self.button_auto_spin.setSelected( 0 )
                    self.setProperty( "autospin", "" )
                else:
                    self.setProperty( "autospin", "true" )
                    self.button_auto_spin.setSelected( 1 )

            elif KEYMAP[ "show_dialog_infos" ][ action ]:
                self._show_infos()

        except:
            print_exc()

    def _start_thread( self ):
        if not self.button_auto_spin.isSelected():
            self._stop_sub_thread()
        if not self.is_rolling and self.cash:
            self.setProperty( "active_spinner", "true" )
            self.play_SFX( PLAY_SPINNER_SFX )
            if self.last_win and self.button_2x.isSelected():
                self.betting = self.last_win * 2
            else:
                self.betting = self.getListItem( self.getCurrentListPosition() ).getLabel().strip( "$" )
                self.set_button_2x()
            self._stop_thread()
            self.is_rolling = True
            self._thread = Thread( target=self.start_spin )
            self._thread.start()
        if self.button_auto_spin.isSelected():
            self._stop_sub_thread()
            self._sub_thread = Timer( 3, self._start_thread, () )
            self._sub_thread.start()

    def _stop_thread( self ):
        try: self._thread.cancel()
        except: pass

    def _stop_sub_thread( self ):
        try: self._sub_thread.cancel()
        except: pass

    def stop_slots( self, slot=0 ):
        if slot:
            if slot == 1:
                self.slot1_stopped = True
            elif slot == 2:
                self.slot2_stopped = True
            elif slot == 3:
                self.slot3_stopped = True
            else:
                self.all_slots_stopped = True
                self._stop_thread()
            self.play_SFX( PLAY_STOP_SFX )

    def start_spin( self ):
        self.setProperty( "lose", "" )
        self.setProperty( "winning", "" )
        self.setProperty( "pot_win", "" )
        self.setProperty( "all_fruits", "" )
        self.setProperty( "slot1_win", "" )
        self.setProperty( "slot2_win", "" )
        self.setProperty( "slot3_win", "" )

        xbmc.sleep( 1200 )
        self.setProperty( "active_spinner", "" )
        #self.clearProperties()
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:69,代码来源:luckygui.py


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