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


Python Gui.show方法代码示例

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


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

示例1: main

# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import show [as 别名]
def main(argv=argv, cfg_file=cfg_file, update=1):
    """
    The function is the client entry point.
    """

    start_dir = os.getcwd()
    os.chdir(join(start_dir, dirname(argv[0]), dirname(cfg_file)))
    cfg_file = join(os.getcwd(), os.path.basename(cfg_file))
    loadConfiguration(cfg_file)
    os.chdir(start_dir)
    path.append(config['servers']['path'])
    path.append(config['configobj']['path'])

    # this import must stay here, after the appending of configobj path to path
    import storage
    storage.init(config['storage']['path'])

    # this import must stay here, after the appending of configobj path to path
    from gui import Gui
    try:
        app = QApplication([])
        app.setStyle(QStyleFactory.create("Cleanlooks"))

        gui = Gui(cfg_file)
        if not update:
            gui.displayWarning(PROJECT_NAME, gui._text['UpdateFail'])
        gui.show()
        exit(app.exec_())

    except Exception, e:
        print 'Fatal Exception:', e
        info = getExceptionInfo()
        fd = open(join(config['exceptions']['save_path'], 'exception.txt'), 'a+')
        fd.write(info)
        fd.close()

        if config['exceptions']['send_email']:
            try:
                sendMail("DevClient fatal exception: %s" % e, info)
            except Exception, e:
                print 'Error while sending email:', e
开发者ID:develersrl,项目名称:devclient,代码行数:43,代码来源:engine.py

示例2: OpenVideoChatActivity

# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import show [as 别名]
class OpenVideoChatActivity(Activity):

    def __init__(self, handle):
        Activity.__init__(self, handle)

        # gobject is used for timeing (will be removed when rtp is implemented)
        gobject.threads_init()

        # Set if they started the activity
        self.isServer = not self._shared_activity

        # Let sugar know we only want a 1 to 1 share (limit to 2 people)
        # Note this is not enforced by sugar yet :(
        self.max_participants = 2

        #FIXME: This is a hack to only allow our ip to be sent once.
        #AKA disables others from double streaming
        if self.isServer:
            # server will send out ip twice, first when joinning empty channel
            # second when the user joins
            self.sent_ip = 2
        else:
            self.sent_ip = 1

        # INITIALIZE GUI
        ################
        self.set_title('OpenVideoChat')

        # Setup Gui
        ###########
        self.gui = Gui(self)
        self.gui.show()
        self.set_canvas(self.gui)

        # Setup Network Stack
        #####################
        self.netstack = SugarNetworkStack(self)
        self._sh_hnd = self.connect('shared', self.netstack.shared_cb)
        self._jo_hnd = self.connect('joined', self.netstack.joined_cb)

        # Setup Pipeline
        #################
        self.gststack = GSTStack(self.gui.send_video_to_screen)
        self.gststack.build_incoming_pipeline()
        gobject.idle_add(self.gststack.start_stop_incoming_pipeline, True)

        print "Activity Started"

    def can_close(self):
        print "Closing, stopping pipelines"
        self.gststack.start_stop_incoming_pipeline(False)
        self.gststack.start_stop_outgoing_pipeline(False)
        return True

    def _alert(self, title, text=None, timeout=5):
        alert = NotifyAlert(timeout=timeout)
        alert.props.title = title
        alert.props.msg = text
        self.add_alert(alert)
        alert.connect('response', self._alert_cancel_cb)
        alert.show()

    def _alert_cancel_cb(self, alert, response_id):
        self.remove_alert(alert)

    def net_cb(self, src, args):
        """
        Callback for network commands
        """
        if src == "chat":
            message, sender = args
            self.gui.add_chat_text(message)

        elif src == "join":
            handle = self.netstack.get_tube_handle()
            if handle and self.sent_ip > 0:
                import socket
                import fcntl
                import struct
                import array
                # http://code.activestate.com/recipes/439094-get-the-ip-address
                # -associated-with-a-network-inter/

                def get_ip_address(ifname):
                    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                    return socket.inet_ntoa(fcntl.ioctl(
                            s.fileno(),
                            0x8915,  # SIOCGIFADDR
                            struct.pack('256s', ifname[:15]))[20:24])

                # http://code.activestate.com/recipes/439093-get-names-of-all-
                # up-network-interfaces-linux-only/

                def all_interfaces():
                    max_possible = 128  # arbitrary. raise if needed.
                    bytes = max_possible * 32
                    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                    names = array.array('B', '\0' * bytes)
                    outbytes = struct.unpack('iL', fcntl.ioctl(
                        s.fileno(),
#.........这里部分代码省略.........
开发者ID:ranjithtenz,项目名称:Open-Video-chat,代码行数:103,代码来源:ovc.py


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