Beispiel #1
0
def create_tool_bar():

    # tool bar
    tool_bar = Gtk.Toolbar()

    tool_button_home = Gtk.ToolButton(Gtk.STOCK_HOME)
    tool_button_home.connect("clicked", click_home_button)
    tool_bar.insert(tool_button_home, 0)

    tool_button_up.connect("clicked", click_up_button)
    tool_button_up.set_sensitive(False)
    tool_bar.insert(tool_button_up, 1)

    tool_button_back.connect("clicked", click_back_button)
    tool_button_back.set_sensitive(False)
    tool_bar.insert(tool_button_back, 2)

    tool_button_forward.connect("clicked", click_forward_button)
    tool_button_forward.set_sensitive(False)
    tool_bar.insert(tool_button_forward, 3)

    #        tool_button_list.connect("clicked", click_list_button)
    #        tool_button_list.set_sensitive(True)
    #        tool_bar.insert(tool_button_list, 4)
    #
    #        tool_button_icon.connect("clicked", click_icon_button)
    #        tool_button_icon.set_sensitive(True)
    #        tool_bar.insert(tool_button_icon, 5)

    toggletoolbutton.set_icon_name("gtk-media-play")
    toggletoolbutton.connect("toggled", click_toggle_button)
    tool_bar.add(toggletoolbutton)

    return tool_bar
Beispiel #2
0
def on_double_click_list(widget, path, column):

    global CURRENT_DIRECTORY
    model = widget.get_model()
    file_name = model[path][1]
    file_is_dir = model[path][2]

    if file_is_dir:
        if CURRENT_DIRECTORY == '/':
            CURRENT_DIRECTORY = CURRENT_DIRECTORY + file_name
        else:
            CURRENT_DIRECTORY = CURRENT_DIRECTORY + '/' + file_name
    else:
        if CURRENT_DIRECTORY == '/':
            current_file = CURRENT_DIRECTORY + file_name
        else:
            current_file = CURRENT_DIRECTORY + '/' + file_name
        subprocess.call(['xdg-open', current_file])

    if (toggletoolbutton.get_active()):
        populate_icon_store()
    else:
        populate_list_store()
    tool_button_up.set_sensitive(True)
    tool_button_back.set_sensitive(True)
    path_list.append(CURRENT_DIRECTORY)
    global path_index
    path_index += 1
    print(path_list, path_index)
Beispiel #3
0
def click_home_button(widget):

    global CURRENT_DIRECTORY
    if CURRENT_DIRECTORY == '/home/hell_abhi':
        return
    CURRENT_DIRECTORY = os.path.realpath(os.path.expanduser('~'))
    if (toggletoolbutton.get_active()):
        populate_icon_store()
    else:
        populate_list_store()
    tool_button_up.set_sensitive(True)
    tool_button_back.set_sensitive(True)
    path_list.append(CURRENT_DIRECTORY)
    global path_index
    path_index += 1
    print(path_list, path_index)
Beispiel #4
0
def click_forward_button(widget):

    global path_index
    if path_index == len(path_list) - 1:
        widget.set_sensitive(False)
        return
    path_index += 1
    print(path_list, path_index)
    tool_button_back.set_sensitive(True)
    global CURRENT_DIRECTORY
    CURRENT_DIRECTORY = path_list[path_index]
    if (toggletoolbutton.get_active()):
        populate_icon_store()
    else:
        populate_list_store()
    if CURRENT_DIRECTORY == '/':
        tool_button_up.set_sensitive(False)