Exemplo n.º 1
0
    def wrapcloseterm(self, widget):
        """A child terminal has closed, so this container must die"""
        dbg('Paned::wrapcloseterm: Called on %s' % widget)

        if self.closeterm(widget):
            # At this point we only have one child, which is the surviving term
            sibling = self.children[0]
            first_term_sibling = sibling
            cur_tabnum = None

            focus_sibling = True
            if self.get_toplevel().is_child_notebook():
                notebook = self.get_toplevel().get_children()[0]
                cur_tabnum = notebook.get_current_page()
                tabnum = notebook.page_num_descendant(self)
                nth_page = notebook.get_nth_page(tabnum)
                exiting_term_was_last_active = (
                    notebook.last_active_term[nth_page] == widget.uuid)
                if exiting_term_was_last_active:
                    first_term_sibling = enumerate_descendants(self)[1][0]
                    notebook.set_last_active_term(first_term_sibling.uuid)
                    notebook.clean_last_active_term()
                    self.get_toplevel().last_active_term = None
                if cur_tabnum != tabnum:
                    focus_sibling = False
            elif self.get_toplevel().last_active_term != widget.uuid:
                focus_sibling = False

            self.remove(sibling)

            metadata = None
            parent = self.get_parent()
            metadata = parent.get_child_metadata(self)
            dbg('metadata obtained for %s: %s' % (self, metadata))
            parent.remove(self)
            self.cnxids.remove_all()
            parent.add(sibling, metadata)
            if cur_tabnum:
                notebook.set_current_page(cur_tabnum)
            if focus_sibling:
                first_term_sibling.grab_focus()
            elif not sibling.get_toplevel().is_child_notebook():
                Terminator().find_terminal_by_uuid(
                    sibling.get_toplevel().last_active_term.urn).grab_focus()
        else:
            dbg("Paned::wrapcloseterm: self.closeterm failed")
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
    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()

        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.classname is not None:
#                self.set_wmclass(options.classname, self.wmclass_class)

            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
Exemplo n.º 5
0
    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.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        self.newtab(widget=child)

        self.show_all()
Exemplo n.º 6
0
    def __init__(self, title, notebook):
        """Class initialiser"""
        GObject.GObject.__init__(self)

        self.notebook = notebook
        self.terminator = Terminator()
        self.config = Config()

        self.label = EditableLabel(title)
        self.label.add_events(2097152)  # SCROLL
        self.label.add_events(4194304)  # TOUCH
        self.label.connect('scroll-event', notebook.on_scroll_event)

        self.update_angle()

        self.pack_start(self.label, True, True, 0)

        self.update_button()
        if self.button:
            self.button.add_events(2097152)  # SCROLL
            self.button.add_events(4194304)  # TOUCH
            self.button.connect('scroll-event', notebook.on_scroll_event)

        self.show_all()
Exemplo n.º 7
0
    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)
        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()
	img = cv2.cvtColor(img, cv2.COLOR_BGR2LAB)  # convert to LAB colour space
	l, a, b = cv2.split(img)  # split channels
	avgV = np.mean(l)  # get avg brigtness
	adjustVal = int(avgV * .85) * mult  # get 85% as value to adjust brightness by

	# adjust brightness channel up
	lAdj = cv2.add(l, adjustVal)

	# merge adjusted channels
	img = cv2.merge((lAdj, a, b))
	img = cv2.cvtColor(img, cv2.COLOR_LAB2BGR)

	return img

if __name__ == '__main__':
	terminator = Terminator()

	if isResuming():
		# remainingfiles, partialData, partialLabels, batchCount = getResumeData(rootFolderLocal)
		remainingfiles, partialData, partialLabels, batchCount = getResumeData(rootFolderGCP)

		# prepare(remainingfiles, rootFolderLocal, terminator, partialData, partialLabels, batchCount)
		prepare(remainingfiles, rootFolderGCP, terminator, partialData, partialLabels, batchCount)

	else:
		# double check the user gave the correct instruction before deleting everything
		ans = input("Are you sure you wish to start from the beginning. \nAll previously generated files will be permently deleted.(y/n)")

		if ans == 'Y' or ans == 'y':
			# removeExistingBatches(rootFolderLocal)
			removeExistingBatches(rootFolderGCP)
Exemplo n.º 9
0
 def __init__(self, terminal):
     """Class initialiser"""
     self.terminal = terminal
     self.terminator = Terminator()
     self.config = Config()
Exemplo n.º 10
0
 def __init__(self):
     """Class initialiser"""
     Plugin.__init__(self)
     terminator = Terminator()
     for terminal in terminator.terminals:
         terminal.match_add(self.handler_name, self.match)
Exemplo n.º 11
0

def main(sheet, nav):
    # Gets the hires from the Google Sheet
    hires = sheet.get_all_values()

    nav.enter_login("https://secure.zenefits.com/accounts/login/",
                    "id_username", "password", "********************",
                    "********************", "loginButton")

    for i, hire in enumerate(
            hires[1:]
    ):  # Takes the first element out to avoid the columns header
        if hire[3] != "" and hire[7] == "":
            hire_name = hire[2]
            hire_email = hire[5]
            employee_id = hire[4]
            end_date = hire[3]
            nav.search_and_terminate_hire(
                "https://secure.zenefits.com/dashboard/#/offboarding/terminate/{}/intro"
                .format(employee_id), hire_name, hire_email, end_date)

            sheet.update_cell(i + 2, 8, "Terminated")


if __name_ == "__main__":
    nav = Terminator()
    sheet = get_gsheet('**************************'
                       )  # Google Sheet name goes as function argument
    main(sheet, nav)