/usr/lib/python2.7/dist-packages/pmg_tk/skins/demo/__init__.py is in pymol 1.8.4.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | # Demonstration of how you would create a new skin
# from scratch
import os
try:
from Tkinter import *
from tkFileDialog import *
except ImportError:
from tkinter import *
from tkinter.filedialog import *
import Pmw
from pmg_tk.skins import PMGSkin
class Demo(PMGSkin):
def fileOpenDialog(self):
if not hasattr(self,'fileOpenPath'):
self.fileOpenPath = os.getcwd()
ofile_list = askopenfilename(initialdir = self.fileOpenPath,
filetypes=self.app.getLoadableFileTypes(),
multiple=1)
for ofile in ofile_list:
if len(ofile):
self.fileOpenPath = os.path.dirname(ofile)
self.cmd.load(ofile,quiet=0)
def quit(self):
self.cmd.log_close()
self.cmd.quit()
def createMenuBar(self):
self.menuBar = Pmw.MenuBar(self.root, # balloon=self.balloon,
hull_relief=RAISED, hull_borderwidth=1)
self.menuBar.pack(fill=X)
self.menuBar.addmenu('File', 'File Menu',tearoff=TRUE)
self.menuBar.addmenuitem('File', 'command', 'Open file',
label='Open...',
command=self.fileOpenDialog)
self.menuBar.addcascademenu('File', 'Skin', 'Skin',
label='Skin',tearoff=TRUE)
self.app.addSkinMenuItems(self.menuBar,'Skin')
self.menuBar.addmenuitem('File', 'command', 'Quit PyMOL',
label='Quit',
command=self.quit)
def destroyMenuBar(self):
self.menuBar.pack_forget()
self.menuBar.destroy()
del self.menuBar
def createInterface(self):
# create the menu bar
self.createMenuBar()
def setup(self):
# call the parent method
PMGSkin.setup(self)
# name the application
self.root.title("Demonstration PyMOL Skin")
# create the user interface
self.createInterface()
# pack the root window
self.app._hull.pack(side=TOP, anchor=CENTER, expand=NO, fill=NONE,
padx=0, pady=0, ipadx=0, ipady=0)
def takedown(self):
self.destroyMenuBar()
PMGSkin.takedown(self)
def __init__(self,app):
PMGSkin.__init__(self,app)
self.app = app
self.pymol = app.pymol
self.cmd = app.pymol.cmd
def __init__(app):
return Demo(app)
|