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


Python terminator.Terminator类代码示例

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


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

示例1: setup_replicator

    def setup_replicator(self):
        '''
        Target:
            - clone a database in PostgreSQL.
        '''
        connecter = self.get_connecter()
        self.logger.debug(Messenger.BEGINNING_EXE_REPLICATOR)
        replicator = self.get_replicator(connecter)

        pg_superuser = connecter.is_pg_superuser()
        if not pg_superuser:
            connecter.cursor.execute(Queries.GET_PG_DB_SOME_DATA,
                                     (replicator.original_dbname, ))
            db = connecter.cursor.fetchone()
            if db['owner'] != connecter.user:
                self.logger.stop_exe(Messenger.ACTION_DB_NO_SUPERUSER)

        # Terminate every connection to the database which is going to be
        # replicated, if necessary
        if self.args.terminate:
            terminator = Terminator(connecter,
                                    target_dbs=[replicator.original_dbname],
                                    logger=self.logger)
            terminator.terminate_backend_dbs([replicator.original_dbname])

        # Clone the database
        replicator.replicate_pg_db()

        # Close connection to PostgreSQL
        connecter.pg_disconnect()
开发者ID:alejandrosantana,项目名称:py_pg_tools,代码行数:30,代码来源:orchestrator.py

示例2: toggle_tab_visibility

    def toggle_tab_visibility(self, widget):
        """tab visibility"""
        status = self.config['tab_position']
        old_tab_position = self.config['old_tab_position']
        if status == 'hidden':
            if old_tab_position:
                #if there's no oldstatus, hidden is default option
                self.config['tab_position'] = old_tab_position
                self.config.save()
        else:
            self.config['old_tab_position'] = status
            self.config['tab_position'] = 'hidden'
            self.config.save()

        terminator = Terminator()
        terminator.reconfigure()
开发者ID:swegener,项目名称:terminator,代码行数:16,代码来源:terminal_popup_menu.py

示例3: __init__

  def __init__(self, user, database):
    # The database connection parameters are specified in the CONFIG.py file.
    # Contains the reference to the database object.
    self.db = None

    # The database cursor.
    self.cursor = None

    # The current connection timeout limit.
    self.timeout = CONNECTION_TIMEOUT

    # The savepoints.
    self.savepoints = []

    # The user to connect with. If no user is specified, picks the first user
    # in the dictionary.
    self.user = user if user is not None else LOGIN.keys()[0]

    # The name of the database to connect to. If none is specified, use
    # <user>_db as the default database.
    self.database = database if database is not None else "%s_db" % self.user

    # Separate database connection used to terminate queries. If the terminator
    # cannot start, the grading cannot occur.
    try:
      self.terminator = Terminator(self.user, self.database)
    except mysql.connector.errors.Error:
      err("Could not start up terminator connection! Any unruly queries " +
          "must be manually killed!")
开发者ID:anjoola,项目名称:cs12x-automate,代码行数:29,代码来源:dbtools.py

示例4: __init__

    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        gtk.Window.__init__(self)
        gobject.type_register(Window)
        self.register_signals(Window)

        self.set_property("allow-shrink", True)
        self.apply_icon()

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()

        options = self.config.options_get()
        if options:
            if options.forcedtitle is not None:
                self.title.force_title(options.forcedtitle)

            if options.role is not None:
                self.set_role(options.role)

            if options.geometry is not None:
                if not self.parse_geometry(options.geometry):
                    err("Window::__init__: Unable to parse geometry: %s" % options.geometry)

        self.pending_set_rough_geometry_hint = False
开发者ID:AmosZ,项目名称:terminal,代码行数:32,代码来源:window.py

示例5: __init__

    def __init__(self, window):
        """Class initialiser"""
        if isinstance(window.get_child(), gtk.Notebook):
            err('There is already a Notebook at the top of this window')
            raise(ValueError)

        Container.__init__(self)
        gtk.Notebook.__init__(self)
        self.terminator = Terminator()
        self.window = window
        gobject.type_register(Notebook)
        self.register_signals(Notebook)
        self.connect('switch-page', self.deferred_on_tab_switch)
        self.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        window_last_active_term = window.last_active_term
        self.newtab(widget=child)
        if window_last_active_term:
            self.set_last_active_term(window_last_active_term)
            window.last_active_term = None

        self.show_all()
开发者ID:dannywillems,项目名称:terminator,代码行数:25,代码来源:notebook.py

示例6: __init__

class LayoutLauncher:
    """Class implementing the various parts of the preferences editor"""
    terminator = None
    config = None
    registry = None
    plugins = None
    keybindings = None
    window = None
    builder = None
    layouttreeview = None
    layouttreestore = None

    def __init__ (self):
        self.terminator = Terminator()
        self.terminator.register_launcher_window(self)

        self.config = config.Config()
        self.config.base.reload()
        self.builder = gtk.Builder()
        try:
            # Figure out where our library is on-disk so we can open our UI
            (head, _tail) = os.path.split(config.__file__)
            librarypath = os.path.join(head, 'layoutlauncher.glade')
            gladefile = open(librarypath, 'r')
            gladedata = gladefile.read()
        except Exception, ex:
            print "Failed to find layoutlauncher.glade"
            print ex
            return

        self.builder.add_from_string(gladedata)
        self.window = self.builder.get_object('layoutlauncherwin')

        icon_theme = gtk.IconTheme()
        try:
            icon = icon_theme.load_icon('terminator-layout', 48, 0)
        except (NameError, gobject.GError):
            dbg('Unable to load 48px Terminator preferences icon')
            icon = self.window.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)
        self.window.set_icon(icon)

        self.builder.connect_signals(self)
        self.window.connect('destroy', self.on_destroy_event)
        self.window.show_all()
        self.layouttreeview = self.builder.get_object('layoutlist')
        self.layouttreestore = self.builder.get_object('layoutstore')
        self.update_layouts()
开发者ID:Reventl0v,项目名称:Terminator,代码行数:47,代码来源:layoutlauncher.py

示例7: on_stone_received

	def on_stone_received(self, stone):
		pid_file = tempfile.mktemp()
		stone = pickle.loads(stone)
		logging.getLogger(__name__).info("received %s task from broker" % stone.name)
		child_pid = os.fork()
		time.sleep(0.1)
		if not child_pid:
			#child
			logging.getLogger(__name__).debug("started child %s" % os.getpid())
			s = Sisyphus(stone, pid_file, ttl=SISYPHUS_JOIN_TTL, logger=logging.getLogger(__name__))
			s.run()
			time.sleep(0.1)
		else:
			#master
			t = Terminator(child_pid, pid_file, ttl=SISYPHUS_WORKER_TTL)
			t.start()
			time.sleep(0.1)
开发者ID:mkorenkov,项目名称:sisyphus,代码行数:17,代码来源:master.py

示例8: __init__

    def __init__(self, terminal):
        """Class initialiser"""
        GObject.GObject.__init__(self)

        self.terminator = Terminator()
        self.terminal = terminal
        self.config = self.terminal.config

        self.label = EditableLabel()
        self.label.connect('edit-done', self.on_edit_done)
        self.ebox = Gtk.EventBox()
        grouphbox = Gtk.HBox()
        self.grouplabel = Gtk.Label(ellipsize='end')
        self.groupicon = Gtk.Image()
        self.bellicon = Gtk.Image()
        self.bellicon.set_no_show_all(True)

        self.groupentry = Gtk.Entry()
        self.groupentry.set_no_show_all(True)
        self.groupentry.connect('focus-out-event', self.groupentry_cancel)
        self.groupentry.connect('activate', self.groupentry_activate)
        self.groupentry.connect('key-press-event', self.groupentry_keypress)

        groupsend_type = self.terminator.groupsend_type
        if self.terminator.groupsend == groupsend_type['all']:
            icon_name = 'all'
        elif self.terminator.groupsend == groupsend_type['group']:
            icon_name = 'group'
        elif self.terminator.groupsend == groupsend_type['off']:
            icon_name = 'off'
        self.set_from_icon_name('_active_broadcast_%s' % icon_name, 
                Gtk.IconSize.MENU)

        grouphbox.pack_start(self.groupicon, False, True, 2)
        grouphbox.pack_start(self.grouplabel, False, True, 2)
        grouphbox.pack_start(self.groupentry, False, True, 2)

        self.ebox.add(grouphbox)
        self.ebox.show_all()

        self.bellicon.set_from_icon_name('terminal-bell', Gtk.IconSize.MENU)

        viewport = Gtk.Viewport(hscroll_policy='natural')
        viewport.add(self.label)

        hbox = Gtk.HBox()
        hbox.pack_start(self.ebox, False, True, 0)
        hbox.pack_start(Gtk.VSeparator(), False, True, 0)
        hbox.pack_start(viewport, True, True, 0)
        hbox.pack_end(self.bellicon, False, False, 2)

        self.add(hbox)
        hbox.show_all()
        self.set_no_show_all(True)
        self.show()

        self.connect('button-press-event', self.on_clicked)
开发者ID:guoxiao,项目名称:terminator-gtk3,代码行数:57,代码来源:titlebar.py

示例9: __init__

    def __init__(self, terminal):
        """Class initialiser"""
        gtk.EventBox.__init__(self)
        self.__gobject_init__()

        self.terminator = Terminator()
        self.terminal = terminal
        self.config = self.terminal.config

        self.label = EditableLabel()
        self.label.connect('edit-done', self.on_edit_done)
        self.ebox = gtk.EventBox()
        grouphbox = gtk.HBox()
        self.grouplabel = gtk.Label()
        self.groupicon = gtk.Image()
        self.bellicon = gtk.Image()
        self.bellicon.set_no_show_all(True)

        self.groupentry = gtk.Entry()
        self.groupentry.set_no_show_all(True)
        self.groupentry.connect('focus-out-event', self.groupentry_cancel)
        self.groupentry.connect('activate', self.groupentry_activate)
        self.groupentry.connect('key-press-event', self.groupentry_keypress)

        groupsend_type = self.terminator.groupsend_type
        if self.terminator.groupsend == groupsend_type['all']:
            icon_name = 'all'
        elif self.terminator.groupsend == groupsend_type['group']:
            icon_name = 'group'
        elif self.terminator.groupsend == groupsend_type['off']:
            icon_name = 'off'
        self.set_from_icon_name('_active_broadcast_%s' % icon_name, 
                gtk.ICON_SIZE_MENU)

        grouphbox.pack_start(self.groupicon, False, True, 2)
        grouphbox.pack_start(self.grouplabel, False, True, 2)
        grouphbox.pack_start(self.groupentry, False, True, 2)

        self.ebox.add(grouphbox)
        self.ebox.show_all()

        self.bellicon.set_from_icon_name('terminal-bell', gtk.ICON_SIZE_MENU)
        hbox = gtk.HBox()
        hbox.pack_start(self.ebox, False, True, 0)
        hbox.pack_start(gtk.VSeparator(), False, True, 0)
        hbox.pack_start(self.label, True, True)
        hbox.pack_end(self.bellicon, False, False, 2)

        self.add(hbox)
        hbox.show_all()
        self.set_no_show_all(True)
        self.show()

        self.connect('button-press-event', self.on_clicked)
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:54,代码来源:titlebar.py

示例10: setup_dropper

    def setup_dropper(self):
        '''
        Target:
            - delete specified databases in PostgreSQL.
        '''
        connecter = self.get_connecter()
        self.logger.debug(Messenger.BEGINNING_EXE_DROPPER)
        dropper = self.get_dropper(connecter)

        # Terminate every connection to the target databases if necessary
        if self.args.terminate:
            terminator = Terminator(connecter, target_dbs=dropper.dbnames,
                                    logger=self.logger)
            terminator.terminate_backend_dbs(dropper.dbnames)

        # Delete the databases
        dropper.drop_pg_dbs(dropper.dbnames)

        # Close connection to PostgreSQL
        connecter.pg_disconnect()
开发者ID:alejandrosantana,项目名称:py_pg_tools,代码行数:20,代码来源:orchestrator.py

示例11: setup_vacuumer

    def setup_vacuumer(self):
        '''
        Target:
            - executes the vacuumer taking into account the value of its
              variables.
        '''
        connecter = self.get_connecter()
        self.logger.debug(Messenger.BEGINNING_EXE_VACUUMER)
        vacuumer = self.get_vacuumer(connecter)

        # Check if the role of user connected to PostgreSQL is superuser
        pg_superuser = connecter.is_pg_superuser()
        if not pg_superuser:
            # Users who are not superusers will only be able to vacuum the
            # databases they own
            vacuumer.db_owner = connecter.user
            self.logger.warning(Messenger.ACTION_DB_NO_SUPERUSER)

        # Get PostgreSQL databases' names, connection permissions and owners
        dbs_all = connecter.get_pg_dbs_data(vacuumer.ex_templates,
                                            vacuumer.db_owner)

        # Show and log their names
        Orchestrator.show_dbs(dbs_all, self.logger)

        # Get the target databases in a list
        vacuum_list = DbSelector.get_filtered_dbs(
            dbs_all, vacuumer.in_dbs, vacuumer.ex_dbs, vacuumer.in_regex,
            vacuumer.ex_regex, vacuumer.in_priority, self.logger)

        # Terminate every connection to these target databases if necessary
        if self.args.terminate:
            terminator = Terminator(connecter, target_dbs=vacuum_list,
                                    logger=self.logger)
            terminator.terminate_backend_dbs(vacuum_list)

        # Vacuum the target databases
        vacuumer.vacuum_dbs(vacuum_list)

        # Close connection to PostgreSQL
        connecter.pg_disconnect()
开发者ID:alejandrosantana,项目名称:py_pg_tools,代码行数:41,代码来源:orchestrator.py

示例12: setup_alterer

    def setup_alterer(self):
        '''
        Target:
            - change the owner of the specified databases in PostgreSQL.
        '''
        connecter = self.get_connecter()
        self.logger.debug(Messenger.BEGINNING_EXE_ALTERER)
        alterer = self.get_alterer(connecter)

        # Check if the role of user connected to PostgreSQL is superuser
        pg_superuser = connecter.is_pg_superuser()
        if not pg_superuser:
            # Users who are not superusers will only be able to backup the
            # databases they own
            owner = connecter.user
            self.logger.highlight('warning', Messenger.ACTION_DB_NO_SUPERUSER,
                                  'yellow', effect='bold')
        else:
            owner = ''

        # Get PostgreSQL databases' names, connection permissions and owners
        dbs_all = connecter.get_pg_dbs_data(ex_templates=False, db_owner=owner)
        # Show and log their names
        Orchestrator.show_dbs(dbs_all, self.logger)

        # Get the target databases in a list
        alt_list = DbSelector.get_filtered_dbs(
            dbs_all=dbs_all, in_dbs=alterer.in_dbs, logger=self.logger)

        # Terminate every connection to the target databases if necessary
        if self.args.terminate:
            terminator = Terminator(connecter, target_dbs=alt_list,
                                    logger=self.logger)
            terminator.terminate_backend_dbs(alt_list)

        # Delete the databases
        alterer.alter_dbs_owner(alt_list)

        # Close connection to PostgreSQL
        connecter.pg_disconnect()
开发者ID:alejandrosantana,项目名称:py_pg_tools,代码行数:40,代码来源:orchestrator.py

示例13: __init__

class LayoutLauncher:
    """Class implementing the various parts of the preferences editor"""
    terminator = None
    config = None
    registry = None
    plugins = None
    keybindings = None
    window = None
    builder = None
    layouttreeview = None
    layouttreestore = None

    def __init__ (self):
        self.terminator = Terminator()
        self.terminator.register_launcher_window(self)

        self.config = config.Config()
        self.config.base.reload()
        self.builder = gtk.Builder()
        try:
            # Figure out where our library is on-disk so we can open our UI
            (head, _tail) = os.path.split(config.__file__)
            librarypath = os.path.join(head, 'layoutlauncher.glade')
            gladefile = open(librarypath, 'r')
            gladedata = gladefile.read()
        except Exception, ex:
            print "Failed to find layoutlauncher.glade"
            print ex
            return

        self.builder.add_from_string(gladedata)
        self.window = self.builder.get_object('layoutlauncherwin')
        self.builder.connect_signals(self)
        self.window.connect('destroy', self.on_destroy_event)
        self.window.show_all()
        self.layouttreeview = self.builder.get_object('layoutlist')
        self.layouttreestore = self.builder.get_object('layoutstore')
        self.update_layouts()
开发者ID:janisozaur,项目名称:terminator,代码行数:38,代码来源:layoutlauncher.py

示例14: prepare_attributes

 def prepare_attributes(self):
     """Ensure we are populated"""
     if not self.bus_name:
         dbg('Checking for bus name availability: %s' % BUS_NAME)
         bus = dbus.SessionBus()
         proxy = bus.get_object('org.freedesktop.DBus', 
                                '/org/freedesktop/DBus')
         flags = 1 | 4 # allow replacement | do not queue
         if not proxy.RequestName(BUS_NAME, dbus.UInt32(flags)) in (1, 4):
             dbg('bus name unavailable: %s' % BUS_NAME)
             raise dbus.exceptions.DBusException(
                 "Couldn't get DBus name %s: Name exists" % BUS_NAME)
         self.bus_name = dbus.service.BusName(BUS_NAME, 
                                              bus=dbus.SessionBus())
     if not self.bus_path:
         self.bus_path = BUS_PATH
     if not self.terminator:
         self.terminator = Terminator()
开发者ID:AmosZ,项目名称:terminal,代码行数:18,代码来源:ipc.py

示例15: __init__

    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        GObject.GObject.__init__(self)
        GObject.type_register(Window)
        self.register_signals(Window)

        self.get_style_context().add_class("terminator-terminal-window")

#        self.set_property('allow-shrink', True)  # FIXME FOR GTK3, or do we need this actually?
        icon_to_apply=''

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()
        
        self.preventHide = False

        options = self.config.options_get()
        if options:
            if options.forcedtitle:
                self.title.force_title(options.forcedtitle)

            if options.role:
                self.set_role(options.role)
            
            if options.forcedicon is not None:
                icon_to_apply = options.forcedicon

            if options.geometry:
                if not self.parse_geometry(options.geometry):
                    err('Window::__init__: Unable to parse geometry: %s' % 
                            options.geometry)

        self.apply_icon(icon_to_apply)
        self.pending_set_rough_geometry_hint = False
开发者ID:albfan,项目名称:terminator,代码行数:41,代码来源:window.py


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