def change_page(self): """ Called by viewmanager at end of realization when arriving on the page At this point the Toolbar is created. We need to: 1. get the menutoolbutton 2. add all possible map services in the drop down menu 3. add the actions that correspond to clicking in this drop down menu 4. set icon and label of the menutoolbutton now that it is realized 5. store label so it can be changed when selection changes """ ListView.change_page(self) #menutoolbutton has to be made and added in correct place on toolbar if not self.maptoolbtn: self.maptoolbtn = Gtk.MenuToolButton() self.maptoolbtn.set_icon_name('go-jump') self.maptoolbtn.connect('clicked', self.gotomap) self.mmenu = self.__create_maps_menu_actions() self.maptoolbtn.set_menu(self.mmenu) self.maptoolbtn.show() tb = self.uistate.viewmanager.uimanager.get_widget('/ToolBar') ind = tb.get_item_index(self.uistate.viewmanager.uimanager.get_widget( '/ToolBar/CommonEdit/Merge')) tb.insert(self.maptoolbtn, ind+1) widget = self.maptoolbtn if not self.mapservicedata: return self.mapslistlabel = [] if not self.mapservice in self.mapservicedata: #stored val no longer exists, use the first key instead self.set_mapservice(list(self.mapservicedata.keys())[0]) #store all gtk labels to be able to update label on selection change_('Loading...'), widget.set_menu(self.mmenu) widget.set_arrow_tooltip_text(_('Select a Map Service')) widget.set_tooltip_text( _("Attempt to see selected locations with a Map " "Service (OpenstreetMap, Google Maps, ...)")) lbl = Gtk.Label(label=self.mapservice_label()) lbl.show() self.mapslistlabel.append(lbl) widget.set_label_widget(self.mapslistlabel[-1]) widget.set_icon_name('go-jump') if self.drag_info(): self.list.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [], Gdk.DragAction.COPY) tglist = Gtk.TargetList.new([]) tglist.add(self.drag_info().atom_drag_type, self.drag_info().target_flags, self.drag_info().app_id) tglist.add_text_targets (0) self.list.drag_source_set_target_list(tglist)
def change_page(self): """ Called by viewmanager at end of realization when arriving on the page At this point the Toolbar is created. We need to: 1. get the menutoolbutton 2. add all possible map services in the drop down menu 3. add the actions that correspond to clicking in this drop down menu 4. set icon and label of the menutoolbutton now that it is realized 5. store label so it can be changed when selection changes """ ListView.change_page(self)
def change_page(self): """ Called by viewmanager at end of realization when arriving on the page At this point the Toolbar is created. We need to: 1. get the menutoolbutton 2. add all possible map services in the drop down menu 3. add the actions that correspond to clicking in this drop down menu 4. set icon and label of the menutoolbutton now that it is realized 5. store label so it can be changed when selection changes """ ListView.change_page(self) if self.drag_info(): self.list.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [], Gdk.DragAction.COPY) tglist = Gtk.TargetList.new([]) tglist.add(self.drag_info().atom_drag_type, self.drag_info().target_flags, self.drag_info().app_id) tglist.add_text_targets (0) self.list.drag_source_set_target_list(tglist)