diff options
author | Oz Linden <oz@lindenlab.com> | 2018-01-17 12:43:28 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2018-01-17 12:43:28 -0500 |
commit | d7c8678c3aa46aed09dce6c1edfc196e72d4b428 (patch) | |
tree | 538a1ef15c2e28676f6a7618bc1e0b5749e2bcea /indra/viewer_components/updater/scripts/darwin/messageframe.py | |
parent | 9e4b977b2fbb565cef88f3d72e07dbdf8cb2cd69 (diff) | |
parent | 7acbd8ed8d73c507675d45360df07d232c431a8b (diff) |
merge 5.1.0-release
Diffstat (limited to 'indra/viewer_components/updater/scripts/darwin/messageframe.py')
-rw-r--r-- | indra/viewer_components/updater/scripts/darwin/messageframe.py | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/indra/viewer_components/updater/scripts/darwin/messageframe.py b/indra/viewer_components/updater/scripts/darwin/messageframe.py deleted file mode 100644 index 8f58848882..0000000000 --- a/indra/viewer_components/updater/scripts/darwin/messageframe.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python -"""\ -@file messageframe.py -@author Nat Goodspeed -@date 2013-01-03 -@brief Define MessageFrame class for popping up messages from a command-line - script. - -$LicenseInfo:firstyear=2013&license=viewerlgpl$ -Copyright (c) 2013, Linden Research, Inc. -$/LicenseInfo$ -""" - -import Tkinter as tk -import os - -# Tricky way to obtain the filename of the main script (default title string) -import __main__ - -# This class is intended for displaying messages from a command-line script. -# Getting the base class right took a bit of trial and error. -# If you derive from tk.Frame, the destroy() method doesn't actually close it. -# If you derive from tk.Toplevel, it pops up a separate Tk frame too. destroy() -# closes this frame, but not that one. -# Deriving from tk.Tk appears to do the right thing. -class MessageFrame(tk.Tk): - def __init__(self, text="", title=os.path.splitext(os.path.basename(__main__.__file__))[0], - width=320, height=120): - tk.Tk.__init__(self) - self.grid() - self.title(title) - self.var = tk.StringVar() - self.var.set(text) - self.msg = tk.Label(self, textvariable=self.var) - self.msg.grid() - # from http://stackoverflow.com/questions/3352918/how-to-center-a-window-on-the-screen-in-tkinter : - self.update_idletasks() - - # The constants below are to adjust for typical overhead from the - # frame borders. - xp = (self.winfo_screenwidth() / 2) - (width / 2) - 8 - yp = (self.winfo_screenheight() / 2) - (height / 2) - 20 - self.geometry('{0}x{1}+{2}+{3}'.format(width, height, xp, yp)) - self.update() - - def set(self, text): - self.var.set(text) - self.update() - -if __name__ == "__main__": - # When run as a script, just test the MessageFrame. - import sys - import time - - frame = MessageFrame("something in the way she moves....") - time.sleep(3) - frame.set("smaller") - time.sleep(3) - frame.set("""this has -several -lines""") - time.sleep(3) - frame.destroy() - print "Destroyed!" - sys.stdout.flush() - time.sleep(3) |