示例#1
0
 def __init__(self, X=None, Y=None, f=None):
     Matcher.__init__(self, X, Y, f)
     self.a = None
     self.A = None
     self.M = None
     self.b = opt_b0
     self.swapped = False
     self.name = "Graduate assignment"
示例#2
0
    def __init__(self, i3) -> None:
        """ Init function

        Args:
            i3: i3ipc connection
        """
        # Initialize superclasses.
        cfg.__init__(self, i3)
        Matcher.__init__(self)

        # Initialization

        # winlist is used to reduce calling i3.get_tree() too many times.
        self.win = None

        # fullscreen_list is used to perform fullscreen hacks
        self.fullscreen_list = []

        # nsgeom used to respect current screen resolution in the geometry
        # settings and scale it
        self.nsgeom = geom.geom(self.cfg)

        # marked used to get the list of current tagged windows
        # with the given tag
        self.marked = {l: [] for l in self.cfg}

        # Mark all tags from the start
        self.mark_all_tags(hide=True)

        # Do not autosave geometry by default
        self.auto_save_geom(False)

        # focus_win_flag is a helper to perform attach/detach window to the
        # named scratchpad with add_prop/del_prop routines
        self.focus_win_flag = [False, ""]

        # i3ipc connection, bypassed by negi3wm runner
        self.i3ipc = i3

        self.bindings = {
            "show": self.show_scratchpad,
            "hide": self.hide_scratchpad_all_but_current,
            "next": self.next_win_on_curr_tag,
            "toggle": self.toggle,
            "hide_current": self.hide_current,
            "geom_restore": self.geom_restore_current,
            "geom_dump": self.geom_dump_current,
            "geom_save": self.geom_save_current,
            "geom_autosave": self.autosave_toggle,
            "subtag": self.run_subtag,
            "add_prop": self.add_prop,
            "del_prop": self.del_prop,
            "reload": self.reload_config,
            "dialog": self.dialog_toggle,
        }

        i3.on('window::new', self.mark_tag)
        i3.on('window::close', self.unmark_tag)
示例#3
0
 def __init__(self, X=None, Y=None, f=None, measure=None):
     Matcher.__init__(self, X, Y, f, measure)
     # measure can be a string - for both nodes and edges attributes
     if isinstance(self.measure, str):
         self.metricNode = self.metricEdge = self.measure
     # or a list of two strings
     elif isinstance(self.measure, list):
         self.metricNode = self.measure[0]
         self.metricEdge = self.measure[1]
     # or a measure defined in a proper way in the distance folder
     else:
         # if sklearn has already it implemented
         if self.measure.get_Instance() in _VALID_METRICS:
             self.metricNode = self.metricEdge = self.measure.get_Instance()
         # if the measure is really user-defined
         else:
             self.metricNode = self.measure.node_dis
             self.metricEdge = self.measure.edge_dis
     self.name = "Gaaaaaaas!"
示例#4
0
文件: circle.py 项目: snide/negi3wm
    def __init__(self, i3) -> None:
        """ Init function

        Main part is in self.initialize, which performs initialization itself.

        Args:
            i3: i3ipc connection
        """
        # Initialize superclasses.
        cfg.__init__(self, i3)
        Matcher.__init__(self)

        # i3ipc connection, bypassed by negi3wm runner.
        self.i3ipc = i3

        # map of tag to the tagged windows.
        self.tagged = {}

        # current_position for the tag [tag]
        self.current_position = {}

        # list of windows which fullscreen state need to be restored.
        self.restore_fullscreen = []

        # is the current action caused by user actions or not? It's needed for
        # corrent fullscreen on/off behaviour.
        self.interactive = True

        # how many attempts taken to find window with priority
        self.repeats = 0

        # win cache for the fast matching
        self.win = None

        # used for subtag info caching
        self.subtag_info = {}

        # Should the special fullscreen-related actions to be performed or not.
        self.need_handle_fullscreen = True

        # Initialize
        i3tree = self.i3ipc.get_tree()

        # prepare for prefullscreen
        self.fullscreened = i3tree.find_fullscreen()

        # store the current window here to cache get_tree().find_focused value.
        self.current_win = i3tree.find_focused()

        # winlist is used to reduce calling i3.get_tree() too many times.
        self.winlist = i3tree.leaves()
        for tag in self.cfg:
            self.tagged[tag] = []
            self.current_position[tag] = 0

        # tag all windows after start
        self.tag_windows(invalidate_winlist=False)

        self.bindings = {
            "next": self.go_next,
            "subtag": self.go_subtag,
            "add_prop": self.add_prop,
            "del_prop": self.del_prop,
            "reload": self.reload_config,
        }

        self.i3ipc.on('window::new', self.add_wins)
        self.i3ipc.on('window::close', self.del_wins)
        self.i3ipc.on("window::focus", self.set_curr_win)
        self.i3ipc.on("window::fullscreen_mode", self.handle_fullscreen)