"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/pmg_qt/mimic_pmg_tk.py" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

mimic_pmg_tk.py  (pymol-open-source-2.2.0):mimic_pmg_tk.py  (pymol-open-source-2.3.0)
skipping to change at line 109 skipping to change at line 109
self._setting = None self._setting = None
@property @property
def setting(self): def setting(self):
if self._setting is None: if self._setting is None:
from pmg_tk.Setting import Setting from pmg_tk.Setting import Setting
self._setting = Setting(self._pmgapp) self._setting = Setting(self._pmgapp)
return self._setting return self._setting
class tkapp_proxy(object):
def __init__(self, proxied, pmgapp):
self._proxied = proxied
self._pmgapp = pmgapp
def __getattr__(self, name):
return getattr(self._proxied, name)
def call(self, tkcmd, *args):
# suspend our own updates for commands which enter the event loop
pause = tkcmd in ('update', 'tkwait', 'vwait')
if pause:
self._pmgapp._tk_update_paused += 1
r = self._proxied.call(tkcmd, *args)
if pause:
self._pmgapp._tk_update_paused -= 1
return r
class PMGApp(object): class PMGApp(object):
def __init__(self): def __init__(self):
import pymol import pymol
self._root = None self._root = None
self.pymol = pymol self.pymol = pymol
self.skin = PMGSkin(self) self.skin = PMGSkin(self)
self._tk_update_paused = 0
@property @property
def root(self): def root(self):
if self._root is None: if self._root is None:
from pymol.Qt import QtCore from pymol.Qt import QtCore
tkinter_init() tkinter_init()
# create Tk instance in this thread # create Tk instance in this thread
self._root = tkinter.Tk() self._root = tkinter.Tk()
self._root.tk = tkapp_proxy(self._root.tk, self)
self._root.withdraw() self._root.withdraw()
# feed Tk event loop from this thread # feed Tk event loop from this thread
timer = QtCore.QTimer() timer = QtCore.QTimer()
@timer.timeout.connect @timer.timeout.connect
def _(): def _():
self._root.update() if not self._tk_update_paused:
timer.start() timer.start()
timer.setSingleShot(True) timer.setSingleShot(True)
timer.start(50) timer.start(50)
# keep reference to timer # keep reference to timer
self._tk_update_timer = timer self._tk_update_timer = timer
import Pmw import Pmw
Pmw.initialise(self._root) Pmw.initialise(self._root)
 End of changes. 4 change blocks. 
1 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)