• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python signals.emit_signal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中urwid.signals.emit_signal函数的典型用法代码示例。如果您正苦于以下问题:Python emit_signal函数的具体用法?Python emit_signal怎么用?Python emit_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _stop

    def _stop(self):
        """
        Restore the screen.
        """
        self.clear()

        signals.emit_signal(self, INPUT_DESCRIPTORS_CHANGED)

        self.signal_restore()

        fd = self._term_input_file.fileno()
        if os.isatty(fd):
            termios.tcsetattr(fd, termios.TCSADRAIN,
        self._old_termios_settings)

        self._mouse_tracking(False)

        move_cursor = ""
        if self._alternate_buffer:
            move_cursor = escape.RESTORE_NORMAL_BUFFER
        elif self.maxrow is not None:
            move_cursor = escape.set_cursor_position(
                0, self.maxrow)
        self.write(
            self._attrspec_to_escape(AttrSpec('',''))
            + escape.SI
            + move_cursor
            + escape.SHOW_CURSOR)

        if self._old_signal_keys:
            self.tty_signal_keys(*(self._old_signal_keys + (fd,)))

        super(Screen, self)._stop()
开发者ID:btreecat,项目名称:bt_text,代码行数:33,代码来源:raw_display.py


示例2: start

    def start(self, alternate_buffer=True):
        """
        Initialize the screen and input mode.

        alternate_buffer -- use alternate screen buffer
        """
        assert not self._started
        if alternate_buffer:
            self._term_output_file.write(escape.SWITCH_TO_ALTERNATE_BUFFER)
            self._rows_used = None
        else:
            self._rows_used = 0

        fd = self._term_input_file.fileno()
        if os.isatty(fd):
            self._old_termios_settings = termios.tcgetattr(fd)
            tty.setcbreak(fd)

        self.signal_init()
        self._alternate_buffer = alternate_buffer
        self._input_iter = self._run_input_iter()
        self._next_timeout = self.max_wait

        if not self._signal_keys_set:
            self._old_signal_keys = self.tty_signal_keys(fileno=fd)

        super(Screen, self).start()

        signals.emit_signal(self, INPUT_DESCRIPTORS_CHANGED)
        # restore mouse tracking to previous state
        self._mouse_tracking(self._mouse_tracking_enabled)
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:31,代码来源:raw_display.py


示例3: _encode_gpm_event

    def _encode_gpm_event( self ):
        self.gpm_event_pending = False
        s = self.gpm_mev.stdout.readline().decode('ascii')
        l = s.split(",")
        if len(l) != 6:
            # unexpected output, stop tracking
            self._stop_gpm_tracking()
            signals.emit_signal(self, INPUT_DESCRIPTORS_CHANGED)
            return []
        ev, x, y, ign, b, m = s.split(",")
        ev = int( ev.split("x")[-1], 16)
        x = int( x.split(" ")[-1] )
        y = int( y.lstrip().split(" ")[0] )
        b = int( b.split(" ")[-1] )
        m = int( m.split("x")[-1].rstrip(), 16 )

        # convert to xterm-like escape sequence

        last = next = self.last_bstate
        l = []
        
        mod = 0
        if m & 1:    mod |= 4 # shift
        if m & 10:    mod |= 8 # alt
        if m & 4:    mod |= 16 # ctrl

        def append_button( b ):
            b |= mod
            l.extend([ 27, ord('['), ord('M'), b+32, x+32, y+32 ])

        if ev == 20: # press
            if b & 4 and last & 1 == 0:
                append_button( 0 )
                next |= 1
            if b & 2 and last & 2 == 0:
                append_button( 1 )
                next |= 2
            if b & 1 and last & 4 == 0:
                append_button( 2 )
                next |= 4
        elif ev == 146: # drag
            if b & 4:
                append_button( 0 + escape.MOUSE_DRAG_FLAG )
            elif b & 2:
                append_button( 1 + escape.MOUSE_DRAG_FLAG )
            elif b & 1:
                append_button( 2 + escape.MOUSE_DRAG_FLAG )
        else: # release
            if b & 4 and last & 1:
                append_button( 0 + escape.MOUSE_RELEASE_FLAG )
                next &= ~ 1
            if b & 2 and last & 2:
                append_button( 1 + escape.MOUSE_RELEASE_FLAG )
                next &= ~ 2
            if b & 1 and last & 4:
                append_button( 2 + escape.MOUSE_RELEASE_FLAG )
                next &= ~ 4
            
        self.last_bstate = next
        return l
开发者ID:AguNnamdi,项目名称:machine-learning,代码行数:60,代码来源:raw_display.py


示例4: set_position_collapsed

 def set_position_collapsed(self, pos, is_collapsed):
     if self._initially_collapsed(pos) == is_collapsed:
         if pos in self._divergent_positions:
             self._divergent_positions.remove(pos)
             signals.emit_signal(self, "modified")
     else:
         if pos not in self._divergent_positions:
             self._divergent_positions.append(pos)
             signals.emit_signal(self, "modified")
开发者ID:pazz,项目名称:urwidtrees-V1,代码行数:9,代码来源:widgets.py


示例5: stop

    def stop(self):
        """
        Restore the screen.
        """
        self.clear()
        if not self._started:
            return

        signals.emit_signal(self, INPUT_DESCRIPTORS_CHANGED)

        self.signal_restore()

        fd = self._term_input_file.fileno()
        if os.isatty(fd):
            termios.tcsetattr(fd, termios.TCSADRAIN,
        self._old_termios_settings)

        move_cursor = ""
        if self.gpm_mev:
            self._stop_gpm_tracking()
        if self._alternate_buffer:
            move_cursor = escape.RESTORE_NORMAL_BUFFER
        elif self.maxrow is not None:
            move_cursor = escape.set_cursor_position( 
                0, self.maxrow)
        self._term_output_file.write(self._attrspec_to_escape(AttrSpec('','')) 
            + escape.SI
            + escape.MOUSE_TRACKING_OFF
            + escape.SHOW_CURSOR
            + move_cursor + "\n" + escape.SHOW_CURSOR )
        self._input_iter = self._fake_input_iter()

        if self._old_signal_keys:
            self.tty_signal_keys(*(self._old_signal_keys + (fd,)))

        super(Screen, self).stop()
开发者ID:AguNnamdi,项目名称:machine-learning,代码行数:36,代码来源:raw_display.py


示例6: register_palette_entry

    def register_palette_entry(self, name, foreground, background,
        mono=None, foreground_high=None, background_high=None):
        """Register a single palette entry.

        name -- new entry/attribute name

        foreground -- a string containing a comma-separated foreground
        color and settings

            Color values:
            'default' (use the terminal's default foreground),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray', 'dark gray',
            'light red', 'light green', 'yellow', 'light blue',
            'light magenta', 'light cyan', 'white'

            Settings:
            'bold', 'underline', 'blink', 'standout'

            Some terminals use 'bold' for bright colors.  Most terminals
            ignore the 'blink' setting.  If the color is not given then
            'default' will be assumed.

        background -- a string containing the background color

            Background color values:
            'default' (use the terminal's default background),
            'black', 'dark red', 'dark green', 'brown', 'dark blue',
            'dark magenta', 'dark cyan', 'light gray'

        mono -- a comma-separated string containing monochrome terminal
        settings (see "Settings" above.)

            None = no terminal settings (same as 'default')

        foreground_high -- a string containing a comma-separated
        foreground color and settings, standard foreground
        colors (see "Color values" above) or high-colors may
        be used

            High-color example values:
            '#009' (0% red, 0% green, 60% red, like HTML colors)
            '#fcc' (100% red, 80% green, 80% blue)
            'g40' (40% gray, decimal), 'g#cc' (80% gray, hex),
            '#000', 'g0', 'g#00' (black),
            '#fff', 'g100', 'g#ff' (white)
            'h8' (color number 8), 'h255' (color number 255)

            None = use foreground parameter value

        background_high -- a string containing the background color,
        standard background colors (see "Background colors" above)
        or high-colors (see "High-color example values" above)
        may be used

            None = use background parameter value
        """
        basic = AttrSpec(foreground, background, 16)

        if type(mono) == tuple:
            # old style of specifying mono attributes was to put them
            # in a tuple.  convert to comma-separated string
            mono = ",".join(mono)
        if mono is None:
            mono = DEFAULT
        mono = AttrSpec(mono, DEFAULT, 1)

        if foreground_high is None:
            foreground_high = foreground
        if background_high is None:
            background_high = background
        high_256 = AttrSpec(foreground_high, background_high, 256)

        # 'hX' where X > 15 are different in 88/256 color, use
        # basic colors for 88-color mode if high colors are specified
        # in this way (also avoids crash when X > 87)
        def large_h(desc):
            if not desc.startswith('h'):
                return False
            if ',' in desc:
            	desc = desc.split(',',1)[0]
            num = int(desc[1:], 10)
            return num > 15
        if large_h(foreground_high) or large_h(background_high):
            high_88 = basic
        else:
            high_88 = AttrSpec(foreground_high, background_high, 88)

        signals.emit_signal(self, UPDATE_PALETTE_ENTRY,
            name, basic, mono, high_88, high_256)
        self._palette[name] = (basic, mono, high_88, high_256)
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:91,代码来源:display_common.py


示例7: _modified

 def _modified(self):
     signals.emit_signal(self, "modified")
开发者ID:jmcb,项目名称:urwid,代码行数:2,代码来源:listbox.py


示例8: set_collapsed_all

 def set_collapsed_all(self, is_collapsed):
     self._initially_collapsed = lambda x: is_collapsed
     self._divergent_positions = []
     newfocus = self._walker.first_ancestor(self._focus)
     self.set_focus(newfocus)
     signals.emit_signal(self, "modified")
开发者ID:pazz,项目名称:urwidtrees-V1,代码行数:6,代码来源:widgets.py


示例9: refresh

 def refresh(self):
     self._walker.clear_cache()
     signals.emit_signal(self._walker, "modified")
开发者ID:craig5,项目名称:salt-console,代码行数:3,代码来源:__init__.py


示例10: _emit

 def _emit(self, name, *args):
     """
     Convenience function to emit signals with self as first
     argument.
     """
     signals.emit_signal(self, name, self, *args)
开发者ID:sporkexec,项目名称:urwid,代码行数:6,代码来源:widget.py


示例11: _emit

 def _emit(self, event, state):
     signals.emit_signal(self, event, Event(type=event, target=self, data={"state": state}))
开发者ID:soasme,项目名称:riotpy,代码行数:2,代码来源:wrapped_widgets.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.apply_target_encoding函数代码示例发布时间:2022-05-27
下一篇:
Python signals.connect_signal函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap