Beispiel #1
0
def press_header(widget, event):

    if not triggers_context_menu(event):
        return False

    treeview = widget.get_parent()
    columns = treeview.get_columns()
    visible_columns = [column for column in columns if column.get_visible()]
    menu = PopupMenu(window=widget.get_toplevel())
    actions = menu.get_actions()
    pos = 1

    for column in columns:
        title = column.get_widget().get_text()

        if title == "":
            title = _("Column #%i") % pos

        menu.setup(("$" + title, None))

        actions[title].set_state(
            GLib.Variant.new_boolean(column in visible_columns))

        if column in visible_columns:
            actions[title].set_enabled(len(visible_columns) > 1)

        actions[title].connect("activate", header_toggle, treeview, columns,
                               pos - 1)
        pos += 1

    menu.popup()
    return True
Beispiel #2
0
    def on_hates_list_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_popup_hates_menu(widget)

        return False
Beispiel #3
0
    def on_tab_click(self, widget, event, page):

        if triggers_context_menu(event):
            return self.on_tab_popup(widget, page)

        if event.button == 2:
            username = self.get_page_owner(page, self.users)
            self.users[username].on_close(widget)
            return True

        return False
Beispiel #4
0
    def on_list_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_popup_menu()

        if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            self.double_click(event)
            return True

        return False
Beispiel #5
0
    def on_folder_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_folder_popup_menu(widget)

        if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            if self.user != self.frame.np.config.sections["server"]["login"]:
                self.on_download_directory(widget)
                return True

        return False
Beispiel #6
0
    def on_tab_click(self, widget, event, page):

        if triggers_context_menu(event):
            return self.on_tab_popup(widget, page)

        elif event.button == 2:
            # Middle click
            tab_label, menu_label = self.get_labels(page)
            tab_label.onclose(widget)
            return True

        return False
Beispiel #7
0
    def on_ru_list_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_popup_ru_menu(widget)

        if event.type == Gdk.EventType._2BUTTON_PRESS:
            user = self.get_selected_item(widget)

            if user is not None:
                self.frame.privatechats.send_message(user)
                self.frame.change_main_page("private")
                return True

        return False
Beispiel #8
0
    def on_list_clicked(self, widget, event):

        set_treeview_selected_row(widget, event)

        if triggers_context_menu(event):
            return self.on_popup_menu(widget)

        if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            room = self.get_selected_room(widget)

            if room is not None and room not in self.joined_rooms:
                self.popup_room = room
                self.on_popup_join()
                return True

        return False
Beispiel #9
0
    def on_tab_click(self, widget, event, child):

        search_id = self.get_search_id(child)

        if search_id is None:
            log.add_warning(_("Search ID was none when clicking tab"))
            return False

        if triggers_context_menu(event):
            return self.on_tab_popup(widget, child)

        if event.button == 2:
            self.searches[search_id]["tab"].on_close(widget)
            return True

        return False
Beispiel #10
0
    def on_file_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_file_popup_menu()

        if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            self.select_files()

            if self.user == config.sections["server"]["login"]:
                self.on_play_files()
            else:
                self.on_download_files()
            return True

        return False
Beispiel #11
0
    def on_list_clicked(self, widget, event):

        if triggers_context_menu(event):
            set_treeview_selected_row(widget, event)
            return self.on_popup_menu(widget)

        pathinfo = widget.get_path_at_pos(event.x, event.y)

        if pathinfo is None:
            widget.get_selection().unselect_all()

        elif event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            self.select_results()
            self.on_download_files(widget)
            self.ResultsList.get_selection().unselect_all()
            return True

        return False
Beispiel #12
0
    def on_image_click(self, widget, event):

        if triggers_context_menu(event):
            return self.on_image_popup_menu(widget)

        return False
Beispiel #13
0
    def on_activity_log_clicked(self, widget, event):

        if triggers_context_menu(event):
            return self.on_popup_activity_log_menu()

        return False
Beispiel #14
0
    def on_message_view_clicked(self, widget, event):

        if triggers_context_menu(event):
            return self.on_popup_menu(widget)

        return False