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

Python gtk2reactor.install函数代码示例

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

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



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

示例1: client

def client():
    from twisted.internet import gtk2reactor
    gtk2reactor.install()
    from twisted.internet import reactor
#    import gobject
#    reactor.callWhenRunning(gobject.threads_init)
#    gobject.threads_init()

    options = ClientOptions()
    options.parseOptions()

    from afm.ui.app import Application
    app = Application(options)

    reactor.addSystemEventTrigger('before', 'shutdown',
                                  logging.getLogger(__name__).info,
                                  'Stopping AFM Client')

    logging.getLogger(__name__).info("AFM Client Started")
    try:
        reactor.run()
    except KeyboardInterrupt:
        reactor.stop()
    except:
        raise
        from twisted.python import log
        log.err()
开发者ID:UfSoft,项目名称:afm,代码行数:27,代码来源:service.py


示例2: activate

 def activate(self, shell):
     from twisted.internet import gtk2reactor
     try:
         gtk2reactor.install()
     except AssertionError, e:
         # sometimes it's already installed
         print e
开发者ID:dignan,项目名称:control,代码行数:7,代码来源:__init__.py


示例3: main

def main():
    from twisted.internet import gtk2reactor
    try:
        gtk2reactor.install()
    except:
        pass
    from twisted.internet import reactor
    con = pynaoqi.getDefaultConnection()
    notes = NotesMain(con)
    notes._w.show_all()
    reactor.run()
开发者ID:alon,项目名称:burst,代码行数:11,代码来源:widgets.py


示例4: installDbusReactor

def installDbusReactor():
    try:
        from twisted.internet import glib2reactor
        glib2reactor.install()
        return True
    except:
        try:
            from twisted.internet import gtk2reactor
            gtk2reactor.install()
            return True
        except:
            return False
开发者ID:braams,项目名称:shtoom,代码行数:12,代码来源:dbus.py


示例5: installgtkreactor

def installgtkreactor():
    import pynaoqi
    options = pynaoqi.getDefaultOptions()
    using_gtk = False
    if options.twisted and not options.nogtk:
        # Try to throw in gtk support
        try:
            from twisted.internet import gtk2reactor
            gtk2reactor.install()
            using_gtk = True
        except AssertionError, e:
            using_gtk = True
        except:
开发者ID:burst,项目名称:burst,代码行数:13,代码来源:shell.py


示例6: main

def main(clazz=Joints):
    global con
    con = pynaoqi.getDefaultConnection(with_twisted=True)
    class Main(clazz):

        def _onDestroy(self, *args):
            super(Main, self)._onDestroy(*args)
            print "quitting.."
            reactor.stop()

    from twisted.internet import gtk2reactor
    try:
        gtk2reactor.install()
    except:
        pass
    window = Main(con)
    reactor.run()
开发者ID:alon,项目名称:burst,代码行数:17,代码来源:gui.py


示例7: main

def main():   
    """Launch the client.

    This is the main entry point. This will first initialise the GUI, then
    load the main module specified on the command line.
    """
    
    options = parser.parse_args()
    if options.module_directory != "":
        directory = options.module_directory
        import sys
        sys.path.append(directory)
    if options.gui == 'gtk':
        from twisted.internet import gtk2reactor
        gtk2reactor.install()
    
    from twisted.internet import reactor    
    modclass = load_file(options.modulename)
    factory = TelnetClientFactory(modclass.name, modclass.encoding, 
                                  options.modulename, reactor)

    if options.gui == 'gtk':
        from pymudclient.gui.gtkgui import configure
        factory.realm.gui = ImperianGui(factory.realm)

    configure(factory)
    factory.realm.module_settings_dir=options.settings_directory
    modinstance = factory.realm.load_module(modclass)
    factory.realm.gmcp_handler = modinstance.gmcp_handler
    

    modinstance.is_main(factory.realm)

    from twisted.internet import reactor

    #pylint kicks up a major fuss about these lines, but that's because 
    #Twisted does some hackery with the reactor namespace.
    #pylint: disable-msg=E1101

    reactor.connectTCP(modclass.host, modclass.port, factory)
    if not options.profile:
        reactor.run()
    else:
        import cProfile
        cProfile.runctx("reactor.run()", globals(), locals(),
                        filename = "pymudclient.prof")
开发者ID:dmoggles,项目名称:pymudclient,代码行数:46,代码来源:mudconnect.py


示例8: main

def main():
    from twisted.internet import gtk2reactor
    reactor = gtk2reactor.install()

    from fbuploader.main_window import MainWindow
    log.info('Starting Main Window')
    main_window = MainWindow()
    main_window.show()

    reactor.run()
开发者ID:damoxc,项目名称:fbuploader,代码行数:10,代码来源:main.py


示例9: main

def main(argv):
    from mushin.common import log
    log.init()
    log.debug('maemo', 'main')

    from twisted.internet import gtk2reactor
    gtk2reactor.install()
    from twisted.internet import reactor

    # set paisley to non-strict since we only have simplejson on maemo
    from mushin.extern.paisley import pjson

    assert not pjson.STRICT

    log.logTwisted()

    reactor.callWhenRunning(start)

    reactor.run()
开发者ID:thomasvs,项目名称:mushin,代码行数:19,代码来源:main.py


示例10: main

def main(application):
    import gnome
    global gnomeProgram
    gnomeProgram = gnome.init("Shtoom", "Whatever Version")

    from twisted.internet import gtk2reactor
    gtk2reactor.install()

    from shtoom.ui.gnomeui.main import ShtoomWindow

    UI = ShtoomWindow()
    UI.connectApplication(application)

    from shtoom import log
    if application.getPref('stdout'):
        import sys
        log.startLogging(sys.stdout, setStdout=False)
    else:
        log.startLogging(UI.getLogger(), setStdout=False)

    return UI
开发者ID:braams,项目名称:shtoom,代码行数:21,代码来源:gnomeshtoom.py


示例11: main

def main(argv, reactor=None):
    """Run the client GUI.

    Typical use:
    >>> sys.exit(main(sys.argv))

    @param argv: The arguments to run it with, e.g. sys.argv.
    @param reactor: The reactor to use. Must be compatible with gtk as this
        module uses gtk API"s.
    @return exitcode: The exit code it returned, as per sys.exit.
    """
    if reactor is None:
        from twisted.internet import gtk2reactor
        gtk2reactor.install()
        from twisted.internet import reactor
    try:
        AWSStatusIcon(reactor)
        gobject.set_application_name("aws-status")
        reactor.run()
    except ValueError:
        # In this case, the user cancelled, and the exception bubbled to here.
        pass
开发者ID:lzimm,项目名称:360io,代码行数:22,代码来源:gtk.py


示例12: run_gtk2

def run_gtk2(config):
    # Put these off until after we parse options, so we know what reactor
    # to load.
    from twisted.internet import gtk2reactor
    gtk2reactor.install()

    # Put this off until after we parse options, or else gnome eats them.
    sys.argv[:] = ['manhole']
    from twisted.manhole.ui import gtk2manhole

    o = config.opts
    defaults = {
        'host': o['host'],
        'port': o['port'],
        'identityName': o['user'],
        'password': o['password'],
        'serviceName': o['service'],
        'perspectiveName': o['perspective']
        }
    w = gtk2manhole.ManholeWindow()
    w.setDefaults(defaults)
    w.login()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:22,代码来源:manhole.py


示例13: run_gtk2

def run_gtk2(config):
    # Put these off until after we parse options, so we know what reactor
    # to load.
    from twisted.internet import gtk2reactor

    gtk2reactor.install()

    # Put this off until after we parse options, or else gnome eats them.
    sys.argv[:] = ["manhole"]
    from twisted.manhole.ui import gtk2manhole

    o = config.opts
    defaults = {
        "host": o["host"],
        "port": o["port"],
        "identityName": o["user"],
        "password": o["password"],
        "serviceName": o["service"],
        "perspectiveName": o["perspective"],
    }
    w = gtk2manhole.ManholeWindow()
    w.setDefaults(defaults)
    w.login()
开发者ID:RockySteveJobs,项目名称:python-for-android,代码行数:23,代码来源:manhole.py


示例14: maybeInstallReactor

def maybeInstallReactor():
    import sys
    try:
        from twisted.internet import gtk3reactor # s/2/3 if you're using gtk3
        reactor = gtk3reactor.install()
        reactor.startRunning()
        reactor._simulate()
        return reactor
    except:
        try:
            from twisted.internet import gtk2reactor
            reactor = gtk2reactor.install()
            reactor.startRunning()
            reactor._simulate()
            return reactor
        except:
            print "This plugin requires twisted to be installed"
            exit(-1)
开发者ID:noisecapella,项目名称:rhythmbox-echonest,代码行数:18,代码来源:echonest-recommender.py


示例15: install

 def install():
   """Start up the Twisted networking support.  Returns the new, running reactor."""
   #This works fine anyway I think?  Not really sure why this is here, just keeping it how it was in Twisted
   if runtime.platform.getType() == 'posix':
     reactor = gtk2reactor.install(ProgramState.USE_GTK)
   #Windows needs this custom class
   else:
     try:
       reactor = GtkReactor()
       installReactor(reactor)
     except socket.error, e:
       #NOTE:  10022 is a bit suspect.  I saw it once (it's "invalid argument"), 
       #but it can apparently happen in cases that might be caused by a firewall...
       #10013 is "forbidden"
       #10047 is "cannot bind"
       #10049 is "Can't assign requested address"
       if e[0] not in (10013, 10047, 10049, 10022):
         raise e
       import win32api
       win32api.MessageBox(0, "You must allow incoming and outgoing connections for both BitBlinder.exe and Tor.exe in your firewall.  Otherwise, BitBlinder will not work correctly.", "Firewalled")
       sys.exit(-5)
开发者ID:clawplach,项目名称:BitBlinder,代码行数:21,代码来源:GtkReactor.py


示例16: file

#    You must obey the GNU General Public License in all respects for all of
#    the code used other than OpenSSL. If you modify file(s) with this
#    exception, you may extend this exception to your version of the file(s),
#    but you are not obligated to do so. If you do not wish to do so, delete
#    this exception statement from your version. If you delete this exception
#    statement from all source files in the program, then also delete it here.
#
#
from deluge.log import LOG as log

import gobject
gobject.set_prgname("deluge")

# Install the twisted reactor
from twisted.internet import gtk2reactor
reactor = gtk2reactor.install()

import gettext
import locale
import pkg_resources
import gtk, gtk.glade
import sys

try:
    from setproctitle import setproctitle, getproctitle
except ImportError:
    setproctitle = lambda t: None
    getproctitle = lambda: None

# Initialize gettext
try:
开发者ID:laanwj,项目名称:deluge,代码行数:31,代码来源:gtkui.py


示例17: __init__

OTHER DEALINGS IN THE SOFTWARE.
"""

import os, sys, platform, subprocess, locale, pickle, json, psutil

import pygtk
pygtk.require('2.0')
import gtk

SHARE = os.getenv('TBL_SHARE', sys.prefix+'/share/torbrowser-launcher')

import gettext
gettext.install('torbrowser-launcher', os.path.join(SHARE, 'locale'))

from twisted.internet import gtk2reactor
gtk2reactor.install()

class Common:

    def __init__(self, tbl_version):
        self.tbl_version = tbl_version

        # initialize the app
        self.default_mirror = 'https://dist.torproject.org/'
        self.discover_arch_lang()
        self.build_paths()
        for d in self.paths['dirs']:
            self.mkdir(self.paths['dirs'][d])
        self.load_mirrors()
        self.load_settings()
        self.mkdir(self.paths['download_dir'])
开发者ID:Dhole,项目名称:torbrowser-launcher,代码行数:31,代码来源:common.py


示例18:

# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members


from twisted.internet import gtk2reactor
gtk2reactor.install()  # @UndefinedVariable

import sys
import time

import pygtk  # @UnresolvedImport
pygtk.require("2.0")
import gobject
import gtk  # @UnresolvedImport
assert(gtk.Window)  # in gtk1 it's gtk.GtkWindow

from twisted.spread import pb

#from buildbot.clients.base import Builder, Client
from buildbot.clients.base import StatusClient
from buildbot.clients.text import TextClient
开发者ID:Acidburn0zzz,项目名称:buildbot,代码行数:31,代码来源:gtkPanes.py


示例19: install_gtk2

def install_gtk2():
    """ Install gtk2 reactor, needs to be called bef """
    from twisted.internet import gtk2reactor
    gtk2reactor.install()
开发者ID:08saikiranreddy,项目名称:ipython,代码行数:4,代码来源:twshell.py


示例20:

# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Lunch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Lunch.  If not, see <http://www.gnu.org/licenses/>.
"""
Main GUI of the Lunch Master 
"""
if __name__ == "__main__":
    from twisted.internet import gtk2reactor
    gtk2reactor.install() # has to be done before importing reactor
from twisted.internet import reactor
from twisted.internet import defer
from twisted.internet import utils
from twisted.python import procutils

import gtk
import pango
import sys
import os
import textwrap
import webbrowser
from lunch import __version__
from lunch import dialogs
from lunch.states import *
from lunch import logger
开发者ID:aalex,项目名称:ubuntu-lunch,代码行数:31,代码来源:gui.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python gtk2reactor.Gtk2Reactor类代码示例发布时间:2022-05-27
下一篇:
Python glib2reactor.install函数代码示例发布时间: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