File: extensions.py

package info (click to toggle)
coot 1.1.18%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 219,964 kB
  • sloc: cpp: 495,934; python: 35,043; ansic: 26,143; lisp: 22,768; sh: 13,186; makefile: 2,746; awk: 441; xml: 245; csh: 14
file content (70 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# extensions.py
# Copyright 2007, 2008 by Bernhard Lohkamp
# Copyright 2006, 2007, 2008 by The University of York
# Copyright 2015 by Medical Research Council
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA

# import pygtk, gtk, pango

import coot
import gi
gi.require_version("Gtk", "4.0") 
from gi.repository import Gtk, GObject
from gi.repository import Gio
from gi.repository import GLib
import coot_gui_api # built into coot binary, not an extension
import time
import numbers
import coot_utils
import coot_gui
import gui_add_linked_cho
import refmac
import gui_prosmart
import fitting
import shelx
import shelx_extensions
import coot_find_baddies
import jligand_gui
import parse_pisa_xml
import ncs

def test_func_for_menus(menumodel: Gio.MenuModel, menu_label: str, submenu_label: str):
    print("Finding", menu_label, submenu_label)
    print("menumodel dir", dir(menumodel))
    if menumodel == False:
        print("********** in my_menumodel_get_menu_item_index()", submenu_label, "null menumodel")
    n = menumodel.get_n_items()
    quoted_menu_label = "'" + menu_label + "'"
    quoted_submenu_label = "'" + submenu_label + "'"
    for i in range(n):
        mmml = menumodel.get_item_attribute_value(i, "label", GLib.VariantType.new("s"))

    idx = 0
    for i in range(n):
        idx = i
        thing = menumodel.get_item_link(idx, "label")
        print("thing", thing, "dir thing", dir(thing))
        #  name = thing.get_name()
        # print("name:", name)
        # l = thing.get_property("label")
        # v = thing.get_value()
        # print("v:", v)

    
menumodel = coot_gui_api.main_menumodel()
if menumodel:
    test_func_for_menus(menumodel, "Edit", "Setting...")