├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CMakeLists.txt ├── Pmw ├── Pmw_2_0_1 │ ├── __init__.py │ ├── bin │ │ └── bundlepmw.py │ ├── contrib │ │ ├── DirBrowser.py │ │ ├── MCListbox.py │ │ ├── PmwFileDialog.py │ │ ├── PmwFullTimeCounter.py │ │ ├── PmwVerticalGauge.py │ │ ├── README │ │ └── TreeBrowser.py │ ├── demos │ │ ├── AboutDialog.py │ │ ├── All.py │ │ ├── Args.py │ │ ├── Balloon.py │ │ ├── BltGraph.py │ │ ├── BltTabset.py │ │ ├── ButtonBox.py │ │ ├── Colors.py │ │ ├── ComboBox.py │ │ ├── ComboBoxDialog.py │ │ ├── ConfigClass.py │ │ ├── Counter.py │ │ ├── CounterDialog.py │ │ ├── DemoVersion.py │ │ ├── Dialog.py │ │ ├── EntryField.py │ │ ├── ErrorHandling.py │ │ ├── ExampleDemo.py │ │ ├── Grid.py │ │ ├── Group.py │ │ ├── HistoryText.py │ │ ├── LabeledWidget.py │ │ ├── LogicalFont.py │ │ ├── MainMenuBar.py │ │ ├── MenuBar.py │ │ ├── MessageBar.py │ │ ├── MessageDialog.py │ │ ├── MessageInfo.py │ │ ├── MultiLineLabel.py │ │ ├── NestedDialogs.py │ │ ├── NoteBook.py │ │ ├── NoteBook_2.py │ │ ├── NoteBook_3.py │ │ ├── OptionMenu.py │ │ ├── PanedWidget.py │ │ ├── PanedWidget_2.py │ │ ├── PromptDialog.py │ │ ├── RadioSelect.py │ │ ├── Resources.py │ │ ├── Resources_Pmw.py │ │ ├── ScrolledCanvas.py │ │ ├── ScrolledField.py │ │ ├── ScrolledFrame.py │ │ ├── ScrolledListBox.py │ │ ├── ScrolledText.py │ │ ├── ScrolledText_2.py │ │ ├── SelectionDialog.py │ │ ├── ShowBusy.py │ │ ├── SpecialCounter.py │ │ ├── SpecialEntry.py │ │ ├── Spectrum.py │ │ ├── SpeedTest.py │ │ ├── SubClassing.py │ │ ├── TextDialog.py │ │ ├── TextDisplay.py │ │ ├── TimeCounter.py │ │ └── WidgetDestroy.py │ ├── doc │ │ ├── AboutDialog.gif │ │ ├── AboutDialog.html │ │ ├── Balloon.gif │ │ ├── Balloon.html │ │ ├── Blt.html │ │ ├── ButtonBox.gif │ │ ├── ButtonBox.html │ │ ├── Color.html │ │ ├── ComboBox.gif │ │ ├── ComboBox.html │ │ ├── ComboBoxDialog.gif │ │ ├── ComboBoxDialog.html │ │ ├── Counter.gif │ │ ├── Counter.html │ │ ├── CounterDialog.gif │ │ ├── CounterDialog.html │ │ ├── Dialog.gif │ │ ├── Dialog.html │ │ ├── EntryField.gif │ │ ├── EntryField.html │ │ ├── ExampleDemo.py │ │ ├── Group.gif │ │ ├── Group.html │ │ ├── HistoryText.gif │ │ ├── HistoryText.html │ │ ├── LabeledWidget.gif │ │ ├── LabeledWidget.html │ │ ├── MainMenuBar.gif │ │ ├── MainMenuBar.html │ │ ├── MegaArchetype.html │ │ ├── MegaToplevel.html │ │ ├── MegaWidget.html │ │ ├── MenuBar.gif │ │ ├── MenuBar.html │ │ ├── MessageBar.gif │ │ ├── MessageBar.html │ │ ├── MessageDialog.gif │ │ ├── MessageDialog.html │ │ ├── NoteBook.gif │ │ ├── NoteBook.html │ │ ├── OptionMenu.gif │ │ ├── OptionMenu.html │ │ ├── PanedWidget.gif │ │ ├── PanedWidget.html │ │ ├── PmwFunctions.html │ │ ├── PromptDialog.gif │ │ ├── PromptDialog.html │ │ ├── RadioSelect.gif │ │ ├── RadioSelect.html │ │ ├── ScrolledCanvas.gif │ │ ├── ScrolledCanvas.html │ │ ├── ScrolledField.gif │ │ ├── ScrolledField.html │ │ ├── ScrolledFrame.gif │ │ ├── ScrolledFrame.html │ │ ├── ScrolledListBox.gif │ │ ├── ScrolledListBox.html │ │ ├── ScrolledText.gif │ │ ├── ScrolledText.html │ │ ├── ScrolledText_test.py │ │ ├── SelectionDialog.gif │ │ ├── SelectionDialog.html │ │ ├── TextDialog.gif │ │ ├── TextDialog.html │ │ ├── TimeCounter.gif │ │ ├── TimeCounter.html │ │ ├── blue_line.gif │ │ ├── blueball.gif │ │ ├── bugs.html │ │ ├── changes.html │ │ ├── copyright.html │ │ ├── counter1.gif │ │ ├── counter2.gif │ │ ├── demosandtests.html │ │ ├── dynamicloader.html │ │ ├── example.py │ │ ├── example1.gif │ │ ├── example2.gif │ │ ├── exercises.py │ │ ├── features.html │ │ ├── halfblueball.gif │ │ ├── howtobuild.html │ │ ├── howtouse.html │ │ ├── index.html │ │ ├── porting.html │ │ ├── refindex.html │ │ ├── scale1.gif │ │ ├── scale2.gif │ │ ├── starting.html │ │ ├── todo.html │ │ └── transdove.gif │ ├── lib │ │ ├── Pmw.def │ │ ├── PmwAboutDialog.py │ │ ├── PmwBalloon.py │ │ ├── PmwBase.py │ │ ├── PmwBlt.py │ │ ├── PmwButtonBox.py │ │ ├── PmwColor.py │ │ ├── PmwComboBox.py │ │ ├── PmwComboBoxDialog.py │ │ ├── PmwCounter.py │ │ ├── PmwCounterDialog.py │ │ ├── PmwDialog.py │ │ ├── PmwEntryField.py │ │ ├── PmwGroup.py │ │ ├── PmwHistoryText.py │ │ ├── PmwLabeledWidget.py │ │ ├── PmwLoader.py │ │ ├── PmwLogicalFont.py │ │ ├── PmwMainMenuBar.py │ │ ├── PmwMenuBar.py │ │ ├── PmwMessageBar.py │ │ ├── PmwMessageDialog.py │ │ ├── PmwNoteBook.py │ │ ├── PmwOptionMenu.py │ │ ├── PmwPanedWidget.py │ │ ├── PmwPromptDialog.py │ │ ├── PmwRadioSelect.py │ │ ├── PmwScrolledCanvas.py │ │ ├── PmwScrolledField.py │ │ ├── PmwScrolledFrame.py │ │ ├── PmwScrolledListBox.py │ │ ├── PmwScrolledText.py │ │ ├── PmwSelectionDialog.py │ │ ├── PmwTextDialog.py │ │ ├── PmwTimeCounter.py │ │ ├── PmwTimeFuncs.py │ │ └── __init__.py │ └── tests │ │ ├── AboutDialog_test.py │ │ ├── All.py │ │ ├── Blt_test.py │ │ ├── ButtonBox_test.py │ │ ├── Colors_test.py │ │ ├── ComboBox_test.py │ │ ├── CounterDialog_test.py │ │ ├── Counter_test.py │ │ ├── Dialog_test.py │ │ ├── EntryField_test.py │ │ ├── LabeledWidget_test.py │ │ ├── ManualTests.py │ │ ├── MegaWidget_test.py │ │ ├── MessageDialog_test.py │ │ ├── NoteBook_test.py │ │ ├── OptionMenu_test.py │ │ ├── Options_test.py │ │ ├── PanedWidget_test.py │ │ ├── PmwBase_test.py │ │ ├── PromptDialog_test.py │ │ ├── RadioSelect_test.py │ │ ├── ScrolledCanvas_test.py │ │ ├── ScrolledField_test.py │ │ ├── ScrolledFrame_test.py │ │ ├── ScrolledListBox_test.py │ │ ├── ScrolledText_test.py │ │ ├── SelectionDialog_test.py │ │ ├── Test.py │ │ ├── TestVersion.py │ │ ├── TextDialog_test.py │ │ ├── Tkinter_test.py │ │ ├── earthris.gif │ │ └── flagup.bmp ├── README └── __init__.py ├── README.md ├── artoolkit-config.h.cmake ├── artoolkit.cmake ├── install-python.ps1 ├── libjpeg-jconfig.h.cmake ├── libjpeg.cmake ├── libode-config.h.cmake ├── libode.cmake ├── libopusfile.cmake ├── libsquish.cmake ├── patches ├── assimp-5.1.6-no-werror.patch ├── bullet-btvector3-shuffle.patch ├── eigen-3.3.9-bad-alloc.patch ├── freetype-2.7.1-harfbuzz-icu.patch ├── harfbuzz-2.6-remove-dead-code.patch ├── opencv-2.4.3-highgui-avfoundation.patch ├── openssl-1.1.1-no-pdb.patch └── squish-1.10-sse.patch └── win-util ├── 7za.exe ├── bison.exe ├── data ├── Makefile.am ├── Makefile.in ├── README ├── bison.m4 ├── c++-skel.m4 ├── c++.m4 ├── c-like.m4 ├── c-skel.m4 ├── c.m4 ├── glr.c ├── glr.cc ├── java-skel.m4 ├── java.m4 ├── lalr1.cc ├── lalr1.java ├── location.cc ├── m4sugar │ ├── foreach.m4 │ └── m4sugar.m4 ├── stack.hh ├── xslt │ ├── bison.xsl │ ├── xml2dot.xsl │ ├── xml2text.xsl │ └── xml2xhtml.xsl └── yacc.c ├── flex.exe ├── nasm.exe └── patch.exe /.gitignore: -------------------------------------------------------------------------------- 1 | /android-libs-*/ 2 | /darwin-libs-a/ 3 | /freebsd-libs-*/ 4 | /linux-libs-*/ 5 | /win-libs-*/ 6 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/__init__.py: -------------------------------------------------------------------------------- 1 | # File to allow this directory to be treated as a python package. 2 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/contrib/README: -------------------------------------------------------------------------------- 1 | This directory contains contributed Pmw megawidgets. 2 | 3 | DirBrowser.py directory selection dialog 4 | MCListbox.py multi-column selectable listbox 5 | PmwFileDialog.py file selection dialog 6 | PmwFullTimeCounter.py time counter which includes year, month and day 7 | PmwVerticalGauge.py a simple gauge indicating a value and a threshold 8 | TreeBrowser.py generic hierarchical tree browser 9 | 10 | Each file can be executed and will display a demo of its megawidget. 11 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/AboutDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.AboutDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create dialog. 13 | Pmw.aboutversion('9.9') 14 | Pmw.aboutcopyright('Copyright My Company 1999\nAll rights reserved') 15 | Pmw.aboutcontact( 16 | 'For information about this application contact:\n' + 17 | ' My Help Desk\n' + 18 | ' Phone: +61 2 9876 5432\n' + 19 | ' email: help@my.company.com.au' 20 | ) 21 | self.about = Pmw.AboutDialog(parent, applicationname = 'My Application') 22 | self.about.withdraw() 23 | 24 | # Create button to launch the dialog. 25 | w = tkinter.Button(parent, text = 'Show about dialog', 26 | command = self.execute) 27 | w.pack(padx = 8, pady = 8) 28 | 29 | def execute(self): 30 | self.about.show() 31 | 32 | ###################################################################### 33 | 34 | # Create demo in root window for testing. 35 | if __name__ == '__main__': 36 | root = tkinter.Tk() 37 | Pmw.initialise(root) 38 | root.title(title) 39 | 40 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 41 | exitButton.pack(side = 'bottom') 42 | widget = Demo(root) 43 | root.mainloop() 44 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ButtonBox.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ButtonBox demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the ButtonBox. 13 | self.buttonBox = Pmw.ButtonBox(parent, 14 | labelpos = 'nw', 15 | label_text = 'ButtonBox:', 16 | frame_borderwidth = 2, 17 | frame_relief = 'groove') 18 | self.buttonBox.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 19 | 20 | # Add some buttons to the ButtonBox. 21 | self.buttonBox.add('OK', command = self.ok) 22 | self.buttonBox.add('Apply', command = self.apply) 23 | self.buttonBox.add('Cancel', command = self.cancel) 24 | 25 | # Set the default button (the one executed when is hit). 26 | self.buttonBox.setdefault('OK') 27 | parent.bind('', self._processReturnKey) 28 | parent.focus_set() 29 | 30 | # Make all the buttons the same width. 31 | self.buttonBox.alignbuttons() 32 | 33 | def _processReturnKey(self, event): 34 | self.buttonBox.invoke() 35 | 36 | def ok(self): 37 | print('You clicked on OK') 38 | 39 | def apply(self): 40 | print('You clicked on Apply') 41 | 42 | def cancel(self): 43 | print('You clicked on Cancel') 44 | 45 | ###################################################################### 46 | 47 | # Create demo in root window for testing. 48 | if __name__ == '__main__': 49 | root = tkinter.Tk() 50 | Pmw.initialise(root) 51 | root.title(title) 52 | 53 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 54 | exitButton.pack(side = 'bottom') 55 | widget = Demo(root) 56 | root.mainloop() 57 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/Colors.py: -------------------------------------------------------------------------------- 1 | title = 'Colorscheme demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | frame = tkinter.Frame(parent) 13 | frame.pack(fill = 'both', expand = 1) 14 | 15 | defaultPalette = Pmw.Color.getdefaultpalette(parent) 16 | 17 | colors = ('red', 'green', 'blue') 18 | items = ('Testing', 'More testing', 'a test', 'foo', 'blah') 19 | for count in range(len(colors)): 20 | color = colors[count] 21 | normalcolor = Pmw.Color.changebrightness(parent, color, 0.85) 22 | Pmw.Color.setscheme(parent, normalcolor) 23 | combo = Pmw.ComboBox(frame, 24 | scrolledlist_items = items, 25 | entryfield_value = items[0]) 26 | combo.grid(sticky='nsew', row = count, column = 0) 27 | 28 | normalcolor = Pmw.Color.changebrightness(parent, color, 0.35) 29 | Pmw.Color.setscheme(parent, normalcolor, foreground = 'white') 30 | combo = Pmw.ComboBox(frame, 31 | scrolledlist_items = items, 32 | entryfield_value = items[0]) 33 | combo.grid(sticky='nsew', row = count, column = 1) 34 | 35 | Pmw.Color.setscheme(*(parent,), **defaultPalette) 36 | #normalcolor = Pmw.Color.changebrightness(parent, 'red', 0.85) 37 | #Pmw.Color.setscheme(parent, normalcolor) 38 | 39 | ###################################################################### 40 | 41 | # Create demo in root window for testing. 42 | if __name__ == '__main__': 43 | root = tkinter.Tk() 44 | Pmw.initialise(root) 45 | root.title(title) 46 | 47 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 48 | exitButton.pack(side = 'bottom') 49 | widget = Demo(root) 50 | root.mainloop() 51 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ComboBox.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ComboBox demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | parent.configure(background = 'white') 13 | 14 | # Create and pack the widget to be configured. 15 | self.target = tkinter.Label(parent, 16 | relief = 'sunken', 17 | padx = 20, 18 | pady = 20, 19 | ) 20 | self.target.pack(fill = 'x', padx = 8, pady = 8) 21 | 22 | # Create and pack the simple ComboBox. 23 | words = ('Monti', 'Python', 'ik', 'den', 'Holie', 'Grailen', '(Bok)') 24 | simple = Pmw.ComboBox(parent, 25 | label_text = 'Simple ComboBox:', 26 | labelpos = 'nw', 27 | selectioncommand = self.changeText, 28 | scrolledlist_items = words, 29 | dropdown = 0, 30 | ) 31 | simple.pack(side = 'left', fill = 'both', 32 | expand = 1, padx = 8, pady = 8) 33 | 34 | # Display the first text. 35 | first = words[0] 36 | simple.selectitem(first) 37 | self.changeText(first) 38 | 39 | # Create and pack the dropdown ComboBox. 40 | colours = ('cornsilk1', 'snow1', 'seashell1', 'antiquewhite1', 41 | 'bisque1', 'peachpuff1', 'navajowhite1', 'lemonchiffon1', 42 | 'ivory1', 'honeydew1', 'lavenderblush1', 'mistyrose1') 43 | dropdown = Pmw.ComboBox(parent, 44 | label_text = 'Dropdown ComboBox:', 45 | labelpos = 'nw', 46 | selectioncommand = self.changeColour, 47 | scrolledlist_items = colours, 48 | ) 49 | dropdown.pack(side = 'left', anchor = 'n', 50 | fill = 'x', expand = 1, padx = 8, pady = 8) 51 | 52 | # Display the first colour. 53 | first = colours[0] 54 | dropdown.selectitem(first) 55 | self.changeColour(first) 56 | 57 | def changeColour(self, colour): 58 | print(('Colour: ' + colour)) 59 | self.target.configure(background = colour) 60 | 61 | def changeText(self, text): 62 | print(('Text: ' + text)) 63 | self.target.configure(text = text) 64 | 65 | ###################################################################### 66 | 67 | # Create demo in root window for testing. 68 | if __name__ == '__main__': 69 | root = tkinter.Tk() 70 | Pmw.initialise(root) 71 | root.title(title) 72 | 73 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 74 | exitButton.pack(side = 'bottom') 75 | widget = Demo(root) 76 | root.mainloop() 77 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ComboBoxDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ComboBoxDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create the dialog. 13 | self.dialog = Pmw.ComboBoxDialog(parent, 14 | title = 'My ComboBoxDialog', 15 | buttons = ('OK', 'Cancel'), 16 | defaultbutton = 'OK', 17 | combobox_labelpos = 'n', 18 | label_text = 'What do you think of Pmw?', 19 | scrolledlist_items = ('Cool man', 'Cool', 'Good', 'Bad', 'Gross')) 20 | self.dialog.withdraw() 21 | 22 | # Create button to launch the dialog. 23 | w = tkinter.Button(parent, 24 | text = 'Show combo box dialog', 25 | command = self.doit) 26 | w.pack(padx = 8, pady = 8) 27 | 28 | def doit(self): 29 | result = self.dialog.activate() 30 | print(('You clicked on', result, self.dialog.get())) 31 | 32 | ###################################################################### 33 | 34 | # Create demo in root window for testing. 35 | if __name__ == '__main__': 36 | root = tkinter.Tk() 37 | Pmw.initialise(root) 38 | root.title(title) 39 | 40 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 41 | exitButton.pack(side = 'bottom') 42 | widget = Demo(root) 43 | root.mainloop() 44 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ConfigClass.py: -------------------------------------------------------------------------------- 1 | title = 'Component python class configuration demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class MyButton(tkinter.Button): 11 | # This is just an ordinary button with special colors. 12 | 13 | def __init__(self, master=None, cnf={}, **kw): 14 | self.__toggle = 0 15 | kw['background'] = 'green' 16 | kw['activebackground'] = 'red' 17 | tkinter.Button.__init__(*(self, master, cnf), **kw) 18 | 19 | class Demo: 20 | def __init__(self, parent): 21 | 22 | # Create a title label: 23 | label = tkinter.Label(parent, 24 | text = 'EntryFields with label components of specified type:') 25 | label.pack(fill='x', expand=1, padx=10, pady=5) 26 | 27 | # Create and pack some EntryFields. 28 | entries = [] 29 | entry = Pmw.EntryField(parent, 30 | labelpos = 'w', 31 | label_text = 'Label' 32 | ) 33 | entry.pack(fill='x', expand=1, padx=10, pady=5) 34 | entries.append(entry) 35 | 36 | entry = Pmw.EntryField(parent, 37 | labelpos = 'w', 38 | label_pyclass = tkinter.Button, 39 | label_text = 'Button' 40 | ) 41 | entry.pack(fill='x', expand=1, padx=10, pady=5) 42 | entries.append(entry) 43 | 44 | entry = Pmw.EntryField(parent, 45 | labelpos = 'w', 46 | label_pyclass = MyButton, 47 | label_text = 'Special button' 48 | ) 49 | entry.pack(fill='x', expand=1, padx=10, pady=5) 50 | entries.append(entry) 51 | 52 | Pmw.alignlabels(entries) 53 | 54 | # Create and pack a ButtonBox. 55 | buttonBox = Pmw.ButtonBox(parent, 56 | labelpos = 'nw', 57 | label_text = 'ButtonBox:') 58 | buttonBox.pack(fill = 'both', expand = 1, padx=10, pady=5) 59 | 60 | # Add some buttons to the ButtonBox. 61 | buttonBox.add('with a') 62 | buttonBox.add('special', pyclass = MyButton) 63 | buttonBox.add('button') 64 | 65 | ###################################################################### 66 | 67 | # Create demo in root window for testing. 68 | if __name__ == '__main__': 69 | root = tkinter.Tk() 70 | Pmw.initialise(root) 71 | root.title(title) 72 | 73 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 74 | exitButton.pack(side = 'bottom') 75 | widget = Demo(root) 76 | root.mainloop() 77 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/CounterDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.CounterDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | # Create the dialog to prompt for the number of times to ring the bell. 14 | self.dialog = Pmw.CounterDialog(parent, 15 | label_text = 'Enter the number of times to\n' + \ 16 | 'sound the bell (1 to 5)\n', 17 | counter_labelpos = 'n', 18 | entryfield_value = 2, 19 | counter_datatype = 'numeric', 20 | entryfield_validate = 21 | {'validator' : 'numeric', 'min' : 1, 'max' : 5}, 22 | buttons = ('OK', 'Cancel'), 23 | defaultbutton = 'OK', 24 | title = 'Bell ringing', 25 | command = self.execute) 26 | self.dialog.withdraw() 27 | 28 | # Create button to launch the dialog. 29 | w = tkinter.Button(parent, text = 'Show counter dialog', 30 | command = self.dialog.activate) 31 | w.pack(padx = 8, pady = 8) 32 | 33 | def execute(self, result): 34 | if result is None or result == 'Cancel': 35 | print('Bell ringing cancelled') 36 | self.dialog.deactivate() 37 | else: 38 | count = self.dialog.get() 39 | if not self.dialog.valid(): 40 | print(('Invalid entry: "' + count + '"')) 41 | else: 42 | print(('Ringing the bell ' + count + ' times')) 43 | for num in range(int(count)): 44 | if num != 0: 45 | self.dialog.after(200) 46 | self.dialog.bell() 47 | self.dialog.deactivate() 48 | 49 | ###################################################################### 50 | 51 | # Create demo in root window for testing. 52 | if __name__ == '__main__': 53 | root = tkinter.Tk() 54 | Pmw.initialise(root) 55 | root.title(title) 56 | 57 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 58 | exitButton.pack(side = 'bottom') 59 | widget = Demo(root) 60 | root.mainloop() 61 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/DemoVersion.py: -------------------------------------------------------------------------------- 1 | # Set the version of Pmw to use for the demonstrations based on the 2 | # directory name. 3 | 4 | import imp 5 | import os 6 | import string 7 | 8 | def expandLinks(path): 9 | if not os.path.isabs(path): 10 | path = os.path.join(os.getcwd(), path) 11 | while 1: 12 | if not os.path.islink(path): 13 | break 14 | dir = os.path.dirname(path) 15 | path = os.path.join(dir, os.readlink(path)) 16 | 17 | return path 18 | 19 | def setPmwVersion(): 20 | file = imp.find_module(__name__)[1] 21 | file = os.path.normpath(file) 22 | file = expandLinks(file) 23 | 24 | dir = os.path.dirname(file) 25 | dir = expandLinks(dir) 26 | dir = os.path.dirname(dir) 27 | dir = expandLinks(dir) 28 | dir = os.path.basename(dir) 29 | 30 | version = dir[4:].replace('_', '.') 31 | import Pmw 32 | if version in Pmw.installedversions(): 33 | Pmw.setversion(version) 34 | else: 35 | print('No such Pmw version', repr(version) + '.', end=' ') 36 | print('Using default version', repr(Pmw.version())) 37 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/Dialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.Dialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create two buttons to launch the dialog. 13 | w = tkinter.Button(parent, text = 'Show application modal dialog', 14 | command = self.showAppModal) 15 | w.pack(padx = 8, pady = 8) 16 | 17 | w = tkinter.Button(parent, text = 'Show global modal dialog', 18 | command = self.showGlobalModal) 19 | w.pack(padx = 8, pady = 8) 20 | 21 | w = tkinter.Button(parent, text = 'Show dialog with "no grab"', 22 | command = self.showDialogNoGrab) 23 | w.pack(padx = 8, pady = 8) 24 | 25 | w = tkinter.Button(parent, text = 26 | 'Show toplevel window which\n' + 27 | 'will not get a busy cursor', 28 | command = self.showExcludedWindow) 29 | w.pack(padx = 8, pady = 8) 30 | 31 | # Create the dialog. 32 | self.dialog = Pmw.Dialog(parent, 33 | buttons = ('OK', 'Apply', 'Cancel', 'Help'), 34 | defaultbutton = 'OK', 35 | title = 'My dialog', 36 | command = self.execute) 37 | self.dialog.withdraw() 38 | 39 | # Add some contents to the dialog. 40 | w = tkinter.Label(self.dialog.interior(), 41 | text = 'Pmw Dialog\n(put your widgets here)', 42 | background = 'black', 43 | foreground = 'white', 44 | pady = 20) 45 | w.pack(expand = 1, fill = 'both', padx = 4, pady = 4) 46 | 47 | # Create the window excluded from showbusycursor. 48 | self.excluded = Pmw.MessageDialog(parent, 49 | title = 'I still work', 50 | message_text = 51 | 'This window will not get\n' + 52 | 'a busy cursor when modal dialogs\n' + 53 | 'are activated. In addition,\n' + 54 | 'you can still interact with\n' + 55 | 'this window when a "no grab"\n' + 56 | 'modal dialog is displayed.') 57 | self.excluded.withdraw() 58 | Pmw.setbusycursorattributes(self.excluded.component('hull'), 59 | exclude = 1) 60 | 61 | def showAppModal(self): 62 | self.dialog.activate(geometry = 'centerscreenalways') 63 | 64 | def showGlobalModal(self): 65 | self.dialog.activate(globalMode = 1) 66 | 67 | def showDialogNoGrab(self): 68 | self.dialog.activate(globalMode = 'nograb') 69 | 70 | def showExcludedWindow(self): 71 | self.excluded.show() 72 | 73 | def execute(self, result): 74 | print(('You clicked on', result)) 75 | if result not in ('Apply', 'Help'): 76 | self.dialog.deactivate(result) 77 | 78 | ###################################################################### 79 | 80 | # Create demo in root window for testing. 81 | if __name__ == '__main__': 82 | root = tkinter.Tk() 83 | Pmw.initialise(root) 84 | root.title(title) 85 | 86 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 87 | exitButton.pack(side = 'bottom') 88 | widget = Demo(root) 89 | root.mainloop() 90 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/EntryField.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.EntryField demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import time 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | # Create and pack the EntryFields. 14 | self._any = Pmw.EntryField(parent, 15 | labelpos = 'w', 16 | label_text = 'Any:', 17 | validate = None, 18 | command = self.execute) 19 | self._real = Pmw.EntryField(parent, 20 | labelpos = 'w', 21 | value = '55.5', 22 | label_text = 'Real (10.0 to 99.0):', 23 | validate = {'validator' : 'real', 24 | 'min' : 10, 'max' : 99, 'minstrict' : 0}, 25 | modifiedcommand = self.changed) 26 | self._odd = Pmw.EntryField(parent, 27 | labelpos = 'w', 28 | label_text = 'Odd length:', 29 | validate = self.custom_validate, 30 | value = 'ABC') 31 | self._date = Pmw.EntryField(parent, 32 | labelpos = 'w', 33 | label_text = 'Date (in 2000):', 34 | value = '2000/2/29', 35 | validate = {'validator' : 'date', 36 | 'min' : '2000/1/1', 'max' : '2000/12/31', 37 | 'minstrict' : 0, 'maxstrict' : 0, 38 | 'fmt' : 'ymd'}, 39 | ) 40 | now = time.localtime(time.time()) 41 | self._date2 = Pmw.EntryField(parent, 42 | labelpos = 'w', 43 | label_text = 'Date (d.m.y):', 44 | value = '%d.%d.%d' % (now[2], now[1], now[0]), 45 | validate = {'validator' : 'date', 46 | 'fmt' : 'dmy', 'separator' : '.'}, 47 | ) 48 | self._time = Pmw.EntryField(parent, 49 | labelpos = 'w', 50 | label_text = 'Time (24hr clock):', 51 | value = '8:00:00', 52 | validate = {'validator' : 'time', 53 | 'min' : '00:00:00', 'max' : '23:59:59', 54 | 'minstrict' : 0, 'maxstrict' : 0}, 55 | ) 56 | self._comma = Pmw.EntryField(parent, 57 | labelpos = 'w', 58 | label_text = 'Real (with comma):', 59 | value = '123,456', 60 | validate = {'validator' : 'real', 'separator' : ','}, 61 | ) 62 | 63 | entries = (self._any, self._real, self._odd, self._date, self._date2, 64 | self._time, self._comma) 65 | 66 | for entry in entries: 67 | entry.pack(fill='x', expand=1, padx=10, pady=5) 68 | Pmw.alignlabels(entries) 69 | 70 | self._any.component('entry').focus_set() 71 | 72 | def changed(self): 73 | print(('Text changed, value is', self._real.getvalue())) 74 | 75 | def execute(self): 76 | print(('Return pressed, value is', self._any.getvalue())) 77 | 78 | # This implements a custom validation routine. It simply checks 79 | # if the string is of odd length. 80 | def custom_validate(self, text): 81 | print(('text:', text)) 82 | if len(text) % 2 == 0: 83 | return -1 84 | else: 85 | return 1 86 | 87 | ###################################################################### 88 | 89 | # Create demo in root window for testing. 90 | if __name__ == '__main__': 91 | root = tkinter.Tk() 92 | Pmw.initialise(root) 93 | root.title(title) 94 | 95 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 96 | exitButton.pack(side = 'bottom') 97 | widget = Demo(root) 98 | root.mainloop() 99 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ErrorHandling.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw error handling demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | # Create two buttons to generate errors. 14 | w = tkinter.Button(parent, text = 'Click here to generate\n' + 15 | 'an error in a command callback.', command = self.execute) 16 | w.pack(padx = 8, pady = 8) 17 | 18 | w = tkinter.Button(parent, text = 'Click here to generate\n' + 19 | 'an error in a callback called\nfrom an event binding.') 20 | w.pack(padx = 8, pady = 8) 21 | w.bind('', self.execute) 22 | w.bind('', self.execute) 23 | 24 | def execute(self, event = None): 25 | self._error() 26 | 27 | def _error(self): 28 | # Divide by zero 29 | 1/0 30 | 31 | ###################################################################### 32 | 33 | # Create demo in root window for testing. 34 | if __name__ == '__main__': 35 | root = tkinter.Tk() 36 | Pmw.initialise(root) 37 | root.title(title) 38 | 39 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 40 | exitButton.pack(side = 'bottom') 41 | widget = Demo(root) 42 | root.mainloop() 43 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ExampleDemo.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.EXAMPLE demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | 13 | # Create and pack the EXAMPLEs. 14 | self.widget1 = Pmw.Counter(parent) 15 | self.widget1.setentry('1') 16 | self.widget1.pack() 17 | 18 | self.widget2 = Pmw.Counter(parent, increment = 10) 19 | self.widget2.setentry('100') 20 | self.widget2.pack() 21 | 22 | ###################################################################### 23 | 24 | # Create demo in root window for testing. 25 | if __name__ == '__main__': 26 | root = tkinter.Tk() 27 | Pmw.initialise(root) 28 | root.title(title) 29 | 30 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 31 | exitButton.pack(side = 'bottom') 32 | widget = Demo(root) 33 | root.mainloop() 34 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/Grid.py: -------------------------------------------------------------------------------- 1 | title = 'Grid geometry manager demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | frame = tkinter.Frame(parent) 13 | frame.pack(fill = 'both', expand = 1) 14 | 15 | button = {} 16 | for num in range(0, 10): 17 | button[num] = tkinter.Button(frame, text = 'Button ' + str(num)) 18 | 19 | button[0].grid(column=0, row=0, rowspan=2, sticky='nsew') 20 | button[1].grid(column=1, row=0, columnspan=3, sticky='nsew') 21 | button[2].grid(column=1, row=1, rowspan=2, sticky='nsew') 22 | button[3].grid(column=2, row=1) 23 | button[4].grid(column=3, row=1) 24 | button[5].grid(column=0, row=2) 25 | button[6].grid(column=0, row=3, columnspan=2, sticky='nsew') 26 | button[7].grid(column=2, row=2, columnspan=2, rowspan=2, sticky='nsew') 27 | button[8].grid(column=0, row=4) 28 | button[9].grid(column=3, row=4, sticky='e') 29 | 30 | frame.grid_rowconfigure(3, weight=1) 31 | frame.grid_columnconfigure(3, weight=1) 32 | 33 | ###################################################################### 34 | 35 | # Create demo in root window for testing. 36 | if __name__ == '__main__': 37 | root = tkinter.Tk() 38 | Pmw.initialise(root) 39 | root.title(title) 40 | 41 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 42 | exitButton.pack(side = 'bottom') 43 | widget = Demo(root) 44 | root.mainloop() 45 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/Group.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.Group demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | 13 | # Create and pack the Groups. 14 | w = Pmw.Group(parent, tag_text='label') 15 | w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) 16 | cw = tkinter.Label(w.interior(), 17 | text = 'A group with the\ndefault Label tag') 18 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 19 | 20 | w = Pmw.Group(parent, tag_pyclass = None) 21 | w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) 22 | cw = tkinter.Label(w.interior(), text = 'A group\nwithout a tag') 23 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 24 | 25 | radiogroups = [] 26 | self.var = tkinter.IntVar() 27 | self.var.set(0) 28 | radioframe = tkinter.Frame(parent) 29 | w = Pmw.Group(radioframe, 30 | tag_pyclass = tkinter.Radiobutton, 31 | tag_text='radiobutton 1', 32 | tag_value = 0, 33 | tag_variable = self.var) 34 | w.pack(fill = 'both', expand = 1, side='left') 35 | cw = tkinter.Frame(w.interior(),width=200,height=20) 36 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 37 | radiogroups.append(w) 38 | 39 | w = Pmw.Group(radioframe, 40 | tag_pyclass = tkinter.Radiobutton, 41 | tag_text='radiobutton 2', 42 | tag_font = Pmw.logicalfont('Helvetica', 4), 43 | tag_value = 1, 44 | tag_variable = self.var) 45 | w.pack(fill = 'both', expand = 1, side='left') 46 | cw = tkinter.Frame(w.interior(),width=200,height=20) 47 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 48 | radiogroups.append(w) 49 | radioframe.pack(padx = 6, pady = 6, expand='yes', fill='both') 50 | Pmw.aligngrouptags(radiogroups) 51 | 52 | w = Pmw.Group(parent, 53 | tag_pyclass = tkinter.Checkbutton, 54 | tag_text='checkbutton', 55 | tag_foreground='blue') 56 | w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) 57 | cw = tkinter.Frame(w.interior(),width=150,height=20) 58 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 59 | 60 | w = Pmw.Group(parent, 61 | tag_pyclass = tkinter.Button, 62 | tag_text='Tkinter.Button') 63 | w.configure(tag_command = w.toggle) 64 | w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) 65 | cw = tkinter.Label(w.interior(), 66 | background = 'aliceblue', 67 | text = 'A group with\na Button tag!?' 68 | ) 69 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 70 | 71 | w = Pmw.Group(parent, 72 | tag_pyclass = tkinter.Button, 73 | tag_text='Show/Hide') 74 | w.configure(tag_command = w.toggle) 75 | w.pack(fill = 'both', expand = 1, padx = 6, pady = 6) 76 | cw = tkinter.Label(w.interior(), 77 | background = 'aliceblue', 78 | text = 'Now you see me.\nNow you don\'t.' 79 | ) 80 | cw.pack(padx = 2, pady = 2, expand='yes', fill='both') 81 | 82 | ###################################################################### 83 | 84 | # Create demo in root window for testing. 85 | if __name__ == '__main__': 86 | root = tkinter.Tk() 87 | Pmw.initialise(root) 88 | root.title(title) 89 | 90 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 91 | exitButton.pack(side = 'bottom') 92 | widget = Demo(root) 93 | root.mainloop() 94 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/HistoryText.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.HistoryText demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the PanedWidget to hold the query and result 13 | # windows. 14 | # !! panedwidget should automatically size to requested size 15 | panedWidget = Pmw.PanedWidget(parent, 16 | orient = 'vertical', 17 | hull_height = 400, 18 | hull_width = 550) 19 | panedWidget.add('query', min = 0.05, size = 0.2) 20 | panedWidget.add('buttons', min = 0.1, max = 0.1) 21 | panedWidget.add('results', min = 0.05) 22 | panedWidget.pack(fill = 'both', expand = 1) 23 | 24 | # Create and pack the HistoryText. 25 | self.historyText = Pmw.HistoryText(panedWidget.pane('query'), 26 | text_wrap = 'none', 27 | text_width = 60, 28 | text_height = 10, 29 | historycommand = self.statechange, 30 | ) 31 | self.historyText.pack(fill = 'both', expand = 1) 32 | self.historyText.component('text').focus() 33 | 34 | buttonList = ( 35 | [20, None], 36 | ['Clear', self.clear], 37 | ['Undo', self.historyText.undo], 38 | ['Redo', self.historyText.redo], 39 | [20, None], 40 | ['Prev', self.historyText.prev], 41 | ['Next', self.historyText.next], 42 | [30, None], 43 | ['Execute', Pmw.busycallback(self.executeQuery)], 44 | ) 45 | self.buttonDict = {} 46 | 47 | buttonFrame = panedWidget.pane('buttons') 48 | for text, cmd in buttonList: 49 | if type(text) == type(69): 50 | frame = tkinter.Frame(buttonFrame, width = text) 51 | frame.pack(side = 'left') 52 | else: 53 | button = tkinter.Button(buttonFrame, text = text, command = cmd) 54 | button.pack(side = 'left') 55 | self.buttonDict[text] = button 56 | 57 | for text in ('Prev', 'Next'): 58 | self.buttonDict[text].configure(state = 'disabled') 59 | 60 | self.results = Pmw.ScrolledText(panedWidget.pane('results'), text_wrap = 'none') 61 | self.results.pack(fill = 'both', expand = 1) 62 | 63 | def statechange(self, prevstate, nextstate): 64 | self.buttonDict['Prev'].configure(state = prevstate) 65 | self.buttonDict['Next'].configure(state = nextstate) 66 | 67 | def clear(self): 68 | self.historyText.delete('1.0', 'end') 69 | 70 | def addnewlines(self, text): 71 | if len(text) == 1: 72 | text = text + '\n' 73 | if text[-1] != '\n': 74 | text = text + '\n' 75 | if text[-2] != '\n': 76 | text = text + '\n' 77 | return text 78 | 79 | def executeQuery(self): 80 | sql = self.historyText.get() 81 | self.results.insert('end', 'Query:\n' + self.addnewlines(sql)) 82 | self.results.see('end') 83 | self.results.update_idletasks() 84 | self.historyText.addhistory() 85 | results = 'Results:\nfoo' 86 | if len(results) > 0: 87 | self.results.insert('end', self.addnewlines(results)) 88 | self.results.see('end') 89 | 90 | 91 | ###################################################################### 92 | 93 | # Create demo in root window for testing. 94 | if __name__ == '__main__': 95 | root = tkinter.Tk() 96 | Pmw.initialise(root) 97 | root.title(title) 98 | 99 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 100 | exitButton.pack(side = 'bottom') 101 | widget = Demo(root) 102 | root.mainloop() 103 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/LabeledWidget.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.LabeledWidget demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | 13 | # Create a frame to put the LabeledWidgets into 14 | frame = tkinter.Frame(parent, background = 'grey90') 15 | frame.pack(fill = 'both', expand = 1) 16 | 17 | # Create and pack the LabeledWidgets. 18 | column = 0 19 | row = 0 20 | for pos in ('n', 'nw', 'wn', 'w'): 21 | lw = Pmw.LabeledWidget(frame, 22 | labelpos = pos, 23 | label_text = pos + ' label') 24 | lw.component('hull').configure(relief='sunken', borderwidth=2) 25 | lw.grid(column=column, row=row, padx=10, pady=10) 26 | cw = tkinter.Button(lw.interior(), text='child\nsite') 27 | cw.pack(padx=10, pady=10, expand='yes', fill='both') 28 | 29 | # Get ready for next grid position. 30 | column = column + 1 31 | if column == 2: 32 | column = 0 33 | row = row + 1 34 | 35 | ###################################################################### 36 | 37 | # Create demo in root window for testing. 38 | if __name__ == '__main__': 39 | root = tkinter.Tk() 40 | Pmw.initialise(root) 41 | root.title(title) 42 | 43 | widget = Demo(root) 44 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 45 | exitButton.pack() 46 | root.mainloop() 47 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/LogicalFont.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw LogicalFont demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | 13 | # The fonts to demonstrate. 14 | fontList = ( 15 | (('Times', 0), {}), 16 | (('Helvetica', 0), {}), 17 | (('Typewriter', 0), {}), 18 | (('Fixed', 0), {}), 19 | (('Courier', 0), {}), 20 | (('Helvetica', 2), {'slant' : 'italic'}), 21 | (('Helvetica', 0), {'size' : 18}), 22 | (('Helvetica', 0), {'weight' : 'bold'}), 23 | (('Helvetica', 12), {'weight' : 'bold', 'slant' : 'italic'}), 24 | (('Typewriter', 0), {'size' : 8, 'weight' : 'bold'}), 25 | (('Fixed', 0), {'size' : 8, 'weight' : 'bold'}), 26 | (('Times', 0), {'size' : 24, 'weight' : 'bold', 'slant' : 'italic'}), 27 | (('Typewriter', 0), {'width' : 'condensed'}), 28 | (('Typewriter', -1), {'width' : 'condensed'}), 29 | (('Fixed', 0), {'width' : 'condensed'}), 30 | (('Fixed', -1), {'width' : 'condensed'}), 31 | (('Helvetica', 0), {'weight' : 'bogus'}), 32 | ) 33 | 34 | fontText = [] 35 | 36 | def __init__(self, parent): 37 | 38 | self.parent = parent 39 | 40 | # Create the text to display to the user to represent each font. 41 | if Demo.fontText == []: 42 | for args, dict in Demo.fontList: 43 | text = args[0] 44 | if args[1] != 0: 45 | text = text + ' ' + str(args[1]) 46 | for name, value in list(dict.items()): 47 | text = text + ' ' + name + ': ' + str(value) 48 | Demo.fontText.append(text) 49 | 50 | # Create a listbox to contain the font selections. 51 | self.box = Pmw.ScrolledListBox(parent, listbox_selectmode='single', 52 | listbox_width = 35, 53 | listbox_height = 10, 54 | items=Demo.fontText, 55 | label_text='Font', labelpos='nw', 56 | selectioncommand=self.selectionCommand) 57 | self.box.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 58 | 59 | # Create a label to display the selected font. 60 | self.target = tkinter.Label(parent, 61 | text = 'The quick brown fox jumps\nover the lazy dog', 62 | relief = 'sunken', padx = 10, pady = 10) 63 | self.target.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 64 | 65 | def selectionCommand(self): 66 | sel = self.box.curselection() 67 | if len(sel) > 0: 68 | args, dict = Demo.fontList[string.atoi(sel[0])] 69 | font = Pmw.logicalfont(*args, **dict) 70 | self.target.configure(font = font) 71 | print(font) 72 | 73 | ###################################################################### 74 | 75 | # Create demo in root window for testing. 76 | if __name__ == '__main__': 77 | root = tkinter.Tk() 78 | Pmw.initialise(root) 79 | root.title(title) 80 | 81 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 82 | exitButton.pack(side = 'bottom') 83 | widget = Demo(root) 84 | root.mainloop() 85 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/MessageBar.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.MessageBar demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the MessageBar. 13 | self._messagebar = Pmw.MessageBar(parent, 14 | entry_width = 40, 15 | entry_relief='groove', 16 | labelpos = 'w', 17 | label_text = 'Status:') 18 | self._messagebar.pack(side = 'bottom', fill = 'x', 19 | expand = 1, padx = 10, pady = 10) 20 | 21 | # Create and pack the ScrolledListBox to change the MessageBar. 22 | self.box = Pmw.ScrolledListBox(parent, 23 | listbox_selectmode='single', 24 | items=('state', 'help', 'userevent', 'systemevent', 25 | 'usererror', 'systemerror', 'busy',), 26 | label_text='Message type', 27 | labelpos='n', 28 | selectioncommand=self.selectionCommand) 29 | self.box.pack(fill = 'both', expand = 'yes', padx = 10, pady = 10) 30 | 31 | self._index = 0 32 | self._stateCounter = 0 33 | 34 | def selectionCommand(self): 35 | sels = self.box.getcurselection() 36 | if len(sels) > 0: 37 | self._index = self._index + 1 38 | messagetype = sels[0] 39 | if messagetype == 'state': 40 | self._stateCounter = (self._stateCounter + 1) % 3 41 | text = stateMessages[self._stateCounter] 42 | if text != '': 43 | text = text + ' (' + messagetype + ')' 44 | self._messagebar.message('state', text) 45 | else: 46 | text = messages[messagetype] 47 | text = text + ' (' + messagetype + ')' 48 | self._messagebar.message(messagetype, text) 49 | if messagetype == 'busy': 50 | Pmw.showbusycursor() 51 | self.box.after(2000) 52 | Pmw.hidebusycursor() 53 | self._messagebar.resetmessages('busy') 54 | text = 'All files successfully removed' 55 | text = text + ' (userevent)' 56 | self._messagebar.message('userevent', text) 57 | 58 | 59 | messages = { 60 | 'help': 'Save current file', 61 | 'userevent': 'Saving file "foo"', 62 | 'busy': 'Busy deleting all files from file system ...', 63 | 'systemevent': 'File "foo" saved', 64 | 'usererror': 'Invalid file name "foo/bar"', 65 | 'systemerror': 'Failed to save file: file system full', 66 | } 67 | 68 | stateMessages = { 69 | 0: '', 70 | 1: 'Database is down', 71 | 2: 'Waiting for reply from database', 72 | } 73 | 74 | ###################################################################### 75 | 76 | # Create demo in root window for testing. 77 | if __name__ == '__main__': 78 | root = tkinter.Tk() 79 | Pmw.initialise(root) 80 | root.title(title) 81 | 82 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 83 | exitButton.pack(side = 'bottom') 84 | widget = Demo(root) 85 | root.mainloop() 86 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/MessageDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.MessageDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | self.parent = parent 13 | 14 | # Create dialog 1. 15 | self.dialog1 = Pmw.MessageDialog(parent, 16 | title = 'Simple message dialog', 17 | defaultbutton = 0, 18 | message_text = 'A simple message dialog\nwith no callback.') 19 | self.dialog1.iconname('Simple message dialog') 20 | self.dialog1.withdraw() 21 | 22 | # Create dialog 2. 23 | self.dialog2 = Pmw.MessageDialog(parent, 24 | title = 'Bell ringing dialog', 25 | message_text = 'This message dialog\nwill ring the bell ' + 26 | 'when\nyou click on the buttons.', 27 | iconpos = 'w', 28 | icon_bitmap = 'error', 29 | command = self.execute2, 30 | buttons = ('One', 'Two', 'Three', 'Close')) 31 | self.dialog2.iconname('Bell ringing dialog') 32 | self.dialog2.withdraw() 33 | 34 | # Create dialog 3. 35 | self.dialog3 = Pmw.MessageDialog(parent, 36 | title = 'Vertical button dialog', 37 | message_text = 'This message dialog\nhas the buttons on the\n' + 38 | 'right hand side.', 39 | buttonboxpos = 'e', 40 | iconpos = 'n', 41 | icon_bitmap = 'warning', 42 | buttons = ('Goodbye', 'Au revoir', 'Sayonara', 'Close'), 43 | defaultbutton = 'Close') 44 | self.dialog3.iconname('Vertical button dialog') 45 | self.dialog3.withdraw() 46 | 47 | # Create some buttons to launch the dialogs. 48 | w = tkinter.Button(parent, text = 'Simple dialog', 49 | command = lambda self = self: 50 | self.dialog1.activate(geometry = 'first+100+100')) 51 | w.pack(padx = 8, pady = 8) 52 | 53 | w = tkinter.Button(parent, text = 'Bell ringing dialog', 54 | command = self.dialog2.activate) 55 | w.pack(padx = 8, pady = 8) 56 | 57 | w = tkinter.Button(parent, text = 'Vertical buttons', 58 | command = self.dialog3.activate) 59 | w.pack(padx = 8, pady = 8) 60 | 61 | w = tkinter.Button(parent, text = 'On the fly dialog', 62 | command = self._createOnTheFly) 63 | w.pack(padx = 8, pady = 8) 64 | 65 | def execute2(self, result): 66 | print(('You clicked on', result)) 67 | if result is None: 68 | self.dialog2.deactivate(result) 69 | elif result == 'Close': 70 | self.dialog2.deactivate(result) 71 | else: 72 | for count in range({'One': 1, 'Two': 2, 'Three': 3}[result]): 73 | if count != 0: 74 | self.dialog2.after(200) 75 | self.dialog2.bell() 76 | 77 | def _createOnTheFly(self): 78 | dialog = Pmw.MessageDialog(self.parent, 79 | title = 'On the fly dialog', 80 | defaultbutton = 0, 81 | buttons = ('OK', 'Apply', 'Cancel', 'Help'), 82 | message_text = 'This dialog was created when you clicked ' + 83 | 'on the button.') 84 | dialog.iconname('Simple message dialog') 85 | result = dialog.activate() 86 | 87 | print(('You selected', result)) 88 | 89 | 90 | 91 | ###################################################################### 92 | 93 | # Create demo in root window for testing. 94 | if __name__ == '__main__': 95 | root = tkinter.Tk() 96 | Pmw.initialise(root) 97 | root.title(title) 98 | 99 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 100 | exitButton.pack(side = 'bottom') 101 | widget = Demo(root) 102 | root.mainloop() 103 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/MultiLineLabel.py: -------------------------------------------------------------------------------- 1 | title = 'Multi-line label demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | 14 | frame = tkinter.Frame(parent, background = '#eeeeee') 15 | frame.pack(fill = 'both', expand = 1, padx = 5, pady = 5) 16 | 17 | stickys = ('n', 's', 'e', 'w', 'ns', 'ew', 'ne', 'nw', 'se', 'sw', 18 | 'nsw', 'nse', 'new', 'sew', 'nsew',) 19 | 20 | widgets = [] 21 | row = 0 22 | column = 0 23 | 24 | # Choose one megawidget class to demonstrate: 25 | cls = Pmw.EntryField 26 | # cls = Pmw.Counter 27 | # cls = Pmw.ComboBox 28 | # cls = Pmw.LabeledWidget 29 | # cls = Pmw.MessageBar 30 | 31 | for sticky in stickys: 32 | dict = {} 33 | dict['sticky'] = sticky 34 | dict['labelpos'] = 'w' 35 | dict['label_text'] = '1\n' + sticky + ':\n3' 36 | if cls == Pmw.EntryField: 37 | dict['value'] = sticky 38 | dict['entry_width'] = 6 39 | if cls == Pmw.Counter or cls == Pmw.ComboBox: 40 | dict['entryfield_value'] = sticky 41 | dict['entry_width'] = 6 42 | widget = cls(*(frame,), **dict) 43 | if cls == Pmw.LabeledWidget: 44 | f = tkinter.Button(widget.interior(), text = sticky) 45 | f.pack(fill = 'both', expand = 1) 46 | if cls == Pmw.MessageBar: 47 | widget.message('state', sticky) 48 | widget.grid(column=column, row=row, sticky='ew', padx = 10, pady = 5) 49 | frame.grid_columnconfigure(column, weight=1) 50 | frame.grid_rowconfigure(row, weight=1) 51 | 52 | widgets.append(widget) 53 | 54 | if row < 4: 55 | row = row + 1 56 | else: 57 | row = 0 58 | column = column + 1 59 | 60 | Pmw.alignlabels(widgets, sticky = 'e') 61 | 62 | ###################################################################### 63 | 64 | # Create demo in root window for testing. 65 | if __name__ == '__main__': 66 | root = tkinter.Tk() 67 | Pmw.initialise(root) 68 | root.title(title) 69 | 70 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 71 | exitButton.pack(side = 'bottom') 72 | widget = Demo(root) 73 | root.mainloop() 74 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/NestedDialogs.py: -------------------------------------------------------------------------------- 1 | title = 'Modal dialog nesting demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create button to launch the dialog. 13 | w = tkinter.Button(parent, text = 'Show first dialog', 14 | command = self.showFirstDialog) 15 | w.pack(padx = 8, pady = 8) 16 | 17 | self.timerId = None 18 | 19 | self.dialog1 = Pmw.MessageDialog(parent, 20 | message_text = 'This is the first modal dialog.\n' + 21 | 'You can see how dialogs nest by\n' + 22 | 'clicking on the "Next" button.', 23 | title = 'Dialog 1', 24 | buttons = ('Next', 'Cancel'), 25 | defaultbutton = 'Next', 26 | command = self.next_dialog) 27 | self.dialog1.withdraw() 28 | 29 | self.dialog2 = Pmw.Dialog(self.dialog1.interior(), 30 | title = 'Dialog 2', 31 | buttons = ('Cancel',), 32 | deactivatecommand = self.cancelTimer, 33 | defaultbutton = 'Cancel') 34 | self.dialog2.withdraw() 35 | w = tkinter.Label(self.dialog2.interior(), 36 | text = 'This is the second modal dialog.\n' + 37 | 'It will automatically disappear shortly') 38 | w.pack(padx = 10, pady = 10) 39 | 40 | def showFirstDialog(self): 41 | self.dialog1.activate() 42 | 43 | def cancelTimer(self): 44 | if self.timerId is not None: 45 | self.dialog2.after_cancel(self.timerId) 46 | self.timerId = None 47 | 48 | def deactivateSecond(self): 49 | self.timerId = None 50 | self.dialog2.deactivate() 51 | 52 | def next_dialog(self, result): 53 | if result != 'Next': 54 | self.dialog1.deactivate() 55 | return 56 | 57 | self.timerId = self.dialog2.after(3000, self.deactivateSecond) 58 | self.dialog2.activate() 59 | 60 | ###################################################################### 61 | 62 | # Create demo in root window for testing. 63 | if __name__ == '__main__': 64 | root = tkinter.Tk() 65 | Pmw.initialise(root) 66 | root.title(title) 67 | 68 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 69 | exitButton.pack(side = 'bottom') 70 | widget = Demo(root) 71 | root.mainloop() 72 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/NoteBook.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.NoteBook demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the NoteBook. 13 | notebook = Pmw.NoteBook(parent) 14 | notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 15 | 16 | # Add the "Appearance" page to the notebook. 17 | page = notebook.add('Appearance') 18 | notebook.tab('Appearance').focus_set() 19 | 20 | # Create the "Toolbar" contents of the page. 21 | group = Pmw.Group(page, tag_text = 'Toolbar') 22 | group.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 23 | b1 = tkinter.Checkbutton(group.interior(), text = 'Show toolbar') 24 | b1.grid(row = 0, column = 0) 25 | b2 = tkinter.Checkbutton(group.interior(), text = 'Toolbar tips') 26 | b2.grid(row = 0, column = 1) 27 | 28 | # Create the "Startup" contents of the page. 29 | group = Pmw.Group(page, tag_text = 'Startup') 30 | group.pack(fill = 'both', expand = 1, padx = 10, pady = 10) 31 | home = Pmw.EntryField(group.interior(), labelpos = 'w', 32 | label_text = 'Home page location:') 33 | home.pack(fill = 'x', padx = 20, pady = 10) 34 | 35 | # Add two more empty pages. 36 | page = notebook.add('Helpers') 37 | page = notebook.add('Images') 38 | 39 | notebook.setnaturalsize() 40 | 41 | ###################################################################### 42 | 43 | # Create demo in root window for testing. 44 | if __name__ == '__main__': 45 | root = tkinter.Tk() 46 | Pmw.initialise(root) 47 | root.title(title) 48 | 49 | widget = Demo(root) 50 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 51 | exitButton.pack() 52 | root.mainloop() 53 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/NoteBook_3.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.NoteBook demonstration (with no tabs)' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | # Reuse the NoteBook with tabs demo. 11 | import NoteBook_2 12 | 13 | class Demo(NoteBook_2.Demo): 14 | def __init__(self, parent): 15 | NoteBook_2.Demo.__init__(self, parent, withTabs = 0) 16 | 17 | # Create demo in root window for testing. 18 | if __name__ == '__main__': 19 | root = tkinter.Tk() 20 | Pmw.initialise(root) 21 | root.title(title) 22 | 23 | widget = Demo(root) 24 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 25 | exitButton.pack() 26 | root.mainloop() 27 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/OptionMenu.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.OptionMenu demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the OptionMenu megawidgets. 13 | # The first one has a textvariable. 14 | self.var = tkinter.StringVar() 15 | self.var.set('steamed') 16 | self.method_menu = Pmw.OptionMenu(parent, 17 | labelpos = 'w', 18 | label_text = 'Choose method:', 19 | menubutton_textvariable = self.var, 20 | items = ['baked', 'steamed', 'stir fried', 'boiled', 'raw'], 21 | menubutton_width = 10, 22 | ) 23 | self.method_menu.pack(anchor = 'w', padx = 10, pady = 10) 24 | 25 | self.vege_menu = Pmw.OptionMenu (parent, 26 | labelpos = 'w', 27 | label_text = 'Choose vegetable:', 28 | items = ('broccoli', 'peas', 'carrots', 'pumpkin'), 29 | menubutton_width = 10, 30 | command = self._printOrder, 31 | ) 32 | self.vege_menu.pack(anchor = 'w', padx = 10, pady = 10) 33 | 34 | self.direction_menu = Pmw.OptionMenu (parent, 35 | labelpos = 'w', 36 | label_text = 'Menu direction:', 37 | items = ('flush', 'above', 'below', 'left', 'right'), 38 | menubutton_width = 10, 39 | command = self._changeDirection, 40 | ) 41 | self.direction_menu.pack(anchor = 'w', padx = 10, pady = 10) 42 | 43 | menus = (self.method_menu, self.vege_menu, self.direction_menu) 44 | Pmw.alignlabels(menus) 45 | 46 | def _printOrder(self, vege): 47 | # Can use 'self.var.get()' instead of 'getcurselection()'. 48 | print(('You have chosen %s %s.' % \ 49 | (self.method_menu.getcurselection(), vege))) 50 | 51 | def _changeDirection(self, direction): 52 | for menu in (self.method_menu, self.vege_menu, self.direction_menu): 53 | menu.configure(menubutton_direction = direction) 54 | 55 | ###################################################################### 56 | 57 | # Create demo in root window for testing. 58 | if __name__ == '__main__': 59 | root = tkinter.Tk() 60 | Pmw.initialise(root) 61 | root.title(title) 62 | 63 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 64 | exitButton.pack(side = 'bottom') 65 | widget = Demo(root) 66 | root.mainloop() 67 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/PanedWidget.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.PanedWidget demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | 13 | # Create a main PanedWidget with a few panes. 14 | self.pw = Pmw.PanedWidget(parent, 15 | orient='vertical', 16 | hull_borderwidth = 1, 17 | hull_relief = 'sunken', 18 | hull_width=300, 19 | hull_height=400) 20 | for self.numPanes in range(4): 21 | if self.numPanes == 1: 22 | name = 'Fixed size' 23 | pane = self.pw.add(name, min = .1, max = .1) 24 | else: 25 | name = 'Pane ' + str(self.numPanes) 26 | pane = self.pw.add(name, min = .1, size = .25) 27 | label = tkinter.Label(pane, text = name) 28 | label.pack(side = 'left', expand = 1) 29 | button = tkinter.Button(pane, text = 'Delete', 30 | command = lambda s=self, n=name: s.deletePane(n)) 31 | button.pack(side = 'left', expand = 1) 32 | # TODO: add buttons to invoke self.moveOneUp and self.moveOneUp. 33 | 34 | self.pw.pack(expand = 1, fill='both') 35 | 36 | buttonBox = Pmw.ButtonBox(parent) 37 | buttonBox.pack(fill = 'x') 38 | buttonBox.add('Add pane', command = self.addPane) 39 | buttonBox.add('Move pane', command = self.move) 40 | self.moveSrc = 0 41 | self.moveNewPos = 1 42 | self.moveBack = 0 43 | 44 | def move(self): 45 | numPanes = len(self.pw.panes()) 46 | if numPanes == 0: 47 | print('No panes to move!') 48 | return 49 | 50 | if self.moveSrc >= numPanes: 51 | self.moveSrc = numPanes - 1 52 | if self.moveNewPos >= numPanes: 53 | self.moveNewPos = numPanes - 1 54 | print(('Moving pane', self.moveSrc, 'to new position', self.moveNewPos)) 55 | self.pw.move(self.moveSrc, self.moveNewPos) 56 | 57 | self.moveSrc, self.moveNewPos = self.moveNewPos, self.moveSrc 58 | if self.moveBack: 59 | if self.moveNewPos == numPanes - 1: 60 | self.moveNewPos = 0 61 | if self.moveSrc == numPanes - 1: 62 | self.moveSrc = 0 63 | else: 64 | self.moveSrc = self.moveSrc + 1 65 | else: 66 | self.moveNewPos = self.moveNewPos + 1 67 | self.moveBack = not self.moveBack 68 | 69 | def addPane(self): 70 | self.numPanes = self.numPanes + 1 71 | name = 'Pane ' + str(self.numPanes) 72 | print(('Adding', name)) 73 | pane = self.pw.add(name, min = .1, size = .25) 74 | label = tkinter.Label(pane, text = name) 75 | label.pack(side = 'left', expand = 1) 76 | button = tkinter.Button(pane, text = 'Delete', 77 | command = lambda s=self, n=name: s.deletePane(n)) 78 | button.pack(side = 'left', expand = 1) 79 | self.pw.updatelayout() 80 | 81 | def deletePane(self, name): 82 | print(('Deleting', name)) 83 | self.pw.delete(name) 84 | self.pw.updatelayout() 85 | 86 | def moveOneUp(self, name): 87 | self.pw.move(name, name, -1) 88 | 89 | def moveOneDown(self, name): 90 | self.pw.move(name, name, 1) 91 | 92 | ###################################################################### 93 | 94 | # Create demo in root window for testing. 95 | if __name__ == '__main__': 96 | root = tkinter.Tk() 97 | Pmw.initialise(root) 98 | root.title(title) 99 | 100 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 101 | exitButton.pack(side = 'bottom') 102 | widget = Demo(root) 103 | root.mainloop() 104 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/PanedWidget_2.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.PanedWidget demonstration (pane factory)' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | self.paneCount = 0 13 | 14 | # Create a "pane factory". 15 | label = tkinter.Label(parent, 16 | pady = 10, 17 | text = 'Below is a simple "pane factory".\n' + 18 | 'Drag the handle on the left\nto create new panes.') 19 | label.pack() 20 | self.factory = Pmw.PanedWidget(parent, 21 | orient='horizontal', 22 | command = self.resize, 23 | hull_borderwidth = 1, 24 | hull_relief = 'raised', 25 | hull_width=300, hull_height=200 26 | ) 27 | self.factory.add('starter', size = 0.0) 28 | self.factory.add('main') 29 | button = tkinter.Button(self.factory.pane('main'), 30 | text = 'Pane\n0') 31 | button.pack(expand = 1) 32 | self.factory.pack(expand = 1, fill = 'both') 33 | 34 | def resize(self, list): 35 | # Remove any panes less than 2 pixel wide. 36 | for i in range(len(list) - 1, 0, -1): 37 | if list[i] < 2: 38 | self.factory.delete(i) 39 | 40 | # If the user has dragged the left hand handle, create a new pane. 41 | if list[0] > 1: 42 | self.paneCount = self.paneCount + 1 43 | 44 | # Add a button to the new pane. 45 | name = self.factory.panes()[0] 46 | text = 'Pane\n' + str(self.paneCount) 47 | button = tkinter.Button(self.factory.pane(name), text = text) 48 | button.pack(expand = 1) 49 | 50 | # Create a new starter pane. 51 | name = 'Pane ' + str(self.paneCount) 52 | self.factory.insert(name, size=0.0) 53 | 54 | ###################################################################### 55 | 56 | # Create demo in root window for testing. 57 | if __name__ == '__main__': 58 | root = tkinter.Tk() 59 | Pmw.initialise(root) 60 | root.title(title) 61 | 62 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 63 | exitButton.pack(side = 'bottom') 64 | widget = Demo(root) 65 | root.mainloop() 66 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/PromptDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.PromptDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | # This may demonstrate a bug in Tk. Click on Cancel in the confirm 11 | # dialog and then click on OK in the password dialog. Under Solaris 12 | # 2.5 and python 1.5, the Cancel button in the confirm dialog is still 13 | # displayed active, that is, it has a lighter background. 14 | 15 | class Demo: 16 | def __init__(self, parent): 17 | # Create the dialog to prompt for the password. 18 | self.dialog = Pmw.PromptDialog(parent, 19 | title = 'Password', 20 | label_text = 'Password:', 21 | entryfield_labelpos = 'n', 22 | entry_show = '*', 23 | defaultbutton = 0, 24 | buttons = ('OK', 'Cancel'), 25 | command = self.execute) 26 | self.dialog.withdraw() 27 | 28 | # Create the confirmation dialog. 29 | self.confirm = Pmw.MessageDialog( 30 | title = 'Are you sure?', 31 | message_text = 'Are you really sure?', 32 | defaultbutton = 0, 33 | buttons = ('OK', 'Cancel')) 34 | self.confirm.withdraw() 35 | 36 | # Create button to launch the dialog. 37 | w = tkinter.Button(parent, text = 'Show prompt dialog', 38 | command = self.dialog.activate) 39 | w.pack(padx = 8, pady = 8) 40 | 41 | def execute(self, result): 42 | if result is None or result == 'Cancel': 43 | print('Password prompt cancelled') 44 | self.dialog.deactivate(result) 45 | else: 46 | result = self.confirm.activate() 47 | if result == 'OK': 48 | print(('Password entered ' + self.dialog.get())) 49 | self.dialog.deactivate() 50 | 51 | ###################################################################### 52 | 53 | # Create demo in root window for testing. 54 | if __name__ == '__main__': 55 | root = tkinter.Tk() 56 | Pmw.initialise(root) 57 | root.title(title) 58 | 59 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 60 | exitButton.pack(side = 'bottom') 61 | widget = Demo(root) 62 | root.mainloop() 63 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/Resources.py: -------------------------------------------------------------------------------- 1 | title = 'Using Tk option database to configure Tk widgets' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | info = """ 12 | The Tk widgets contained in this 13 | simple megawidget have been 14 | configured using the Tk option 15 | database. 16 | *DemoClass*Listbox.cursor is 'heart' 17 | *DemoClass*Entry.cursor is 'hand1' 18 | *DemoClass*background is 'pink' 19 | *DemoClass*highlightBackground is 'green' 20 | *DemoClass*foreground is 'blue' 21 | """ 22 | 23 | class DemoClass(Pmw.MegaWidget): 24 | 25 | # Demo Pmw megawidget. 26 | 27 | def __init__(self, parent = None, **kw): 28 | 29 | # Define the megawidget options. 30 | optiondefs = () 31 | self.defineoptions(kw, optiondefs) 32 | 33 | # Initialise the base class (after defining the options). 34 | Pmw.MegaWidget.__init__(self, parent) 35 | 36 | interior = self.interior() 37 | listbox = tkinter.Listbox(interior, height = 12, width = 40) 38 | listbox.pack(fill='both', expand='yes') 39 | for line in info.split('\n'): 40 | listbox.insert('end', line) 41 | 42 | entry = tkinter.Entry(interior) 43 | entry.pack(fill='y') 44 | entry.insert(0, 'Hello, World!') 45 | 46 | # Check keywords and initialise options. 47 | self.initialiseoptions() 48 | 49 | class Demo: 50 | def __init__(self, parent): 51 | 52 | # Test Tk option database settings. 53 | parent.option_add('*DemoClass*Listbox.cursor', 'heart') 54 | parent.option_add('*DemoClass*Entry.cursor', 'hand1') 55 | parent.option_add('*DemoClass*background', 'pink') 56 | parent.option_add('*DemoClass*highlightBackground', 'green') 57 | parent.option_add('*DemoClass*foreground', 'blue') 58 | 59 | # Create and pack the megawidget. 60 | demo = DemoClass(parent) 61 | demo.pack(fill = 'both', expand = 1) 62 | 63 | ###################################################################### 64 | 65 | # Create demo in root window for testing. 66 | if __name__ == '__main__': 67 | root = tkinter.Tk() 68 | Pmw.initialise(root) 69 | root.title(title) 70 | 71 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 72 | exitButton.pack(side = 'bottom') 73 | widget = Demo(root) 74 | root.mainloop() 75 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ScrolledField.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ScrolledField demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack the ScrolledField. 13 | self._field = Pmw.ScrolledField(parent, entry_width = 30, 14 | entry_relief='groove', labelpos = 'n', 15 | label_text = 'Scroll the field using the\nmiddle mouse button') 16 | self._field.pack(fill = 'x', expand = 1, padx = 10, pady = 10) 17 | 18 | # Create and pack a button to change the ScrolledField. 19 | self._button = tkinter.Button(parent, text = 'Change field', 20 | command = self.execute) 21 | self._button.pack(padx = 10, pady = 10) 22 | 23 | self._index = 0 24 | self.execute() 25 | 26 | def execute(self): 27 | self._field.configure(text = lines[self._index % len(lines)]) 28 | self._index = self._index + 1 29 | 30 | lines = ( 31 | 'Alice was beginning to get very tired of sitting by her sister', 32 | 'on the bank, and of having nothing to do: once or twice she had', 33 | 'peeped into the book her sister was reading, but it had no', 34 | 'pictures or conversations in it, "and what is the use of a book,"', 35 | 'thought Alice "without pictures or conversation?"', 36 | 'Alice\'s Adventures in Wonderland', 37 | 'Lewis Carroll', 38 | ) 39 | 40 | ###################################################################### 41 | 42 | # Create demo in root window for testing. 43 | if __name__ == '__main__': 44 | root = tkinter.Tk() 45 | Pmw.initialise(root) 46 | root.title(title) 47 | 48 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 49 | exitButton.pack(side = 'bottom') 50 | widget = Demo(root) 51 | root.mainloop() 52 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ScrolledText.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ScrolledText demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import os 8 | import math 9 | import string 10 | import tkinter 11 | import Pmw 12 | 13 | class Demo: 14 | def __init__(self, parent): 15 | 16 | # Create the ScrolledText with headers. 17 | fixedFont = Pmw.logicalfont('Fixed') 18 | self.st = Pmw.ScrolledText(parent, 19 | # borderframe = 1, 20 | labelpos = 'n', 21 | label_text='ScrolledText with headers', 22 | columnheader = 1, 23 | rowheader = 1, 24 | rowcolumnheader = 1, 25 | usehullsize = 1, 26 | hull_width = 400, 27 | hull_height = 300, 28 | text_wrap='none', 29 | text_font = fixedFont, 30 | Header_font = fixedFont, 31 | Header_foreground = 'blue', 32 | rowheader_width = 3, 33 | rowcolumnheader_width = 3, 34 | text_padx = 4, 35 | text_pady = 4, 36 | Header_padx = 4, 37 | rowheader_pady = 4, 38 | ) 39 | 40 | self.st.pack(padx = 5, pady = 5, fill = 'both', expand = 1) 41 | 42 | funcs = 'atan cos cosh exp log log10 sin sinh sqrt tan tanh' 43 | funcs = funcs.split() 44 | 45 | # Create the header for the row headers 46 | self.st.component('rowcolumnheader').insert('end', 'x') 47 | 48 | # Create the column headers 49 | headerLine = '' 50 | for column in range(len(funcs)): 51 | headerLine = headerLine + ('%-7s ' % (funcs[column],)) 52 | headerLine = headerLine[:-3] 53 | self.st.component('columnheader').insert('0.0', headerLine) 54 | 55 | self.st.tag_configure('yellow', background = 'yellow') 56 | 57 | # Create the data rows and the row headers 58 | numRows = 50 59 | tagList = [] 60 | for row in range(1, numRows): 61 | dataLine = '' 62 | x = row / 5.0 63 | for column in range(len(funcs)): 64 | value = eval('math.' + funcs[column] + '(' + str(x) + ')') 65 | data = str(value)[:7] 66 | if value < 0: 67 | tag1 = '%d.%d' % (row, len(dataLine)) 68 | tag2 = '%d.%d' % (row, len(dataLine) + len(data)) 69 | tagList.append(tag1) 70 | tagList.append(tag2) 71 | data = '%-7s' % (data,) 72 | dataLine = dataLine + data + ' ' 73 | dataLine = dataLine[:-3] 74 | header = '%.1f' % (x,) 75 | if row < numRows - 1: 76 | dataLine = dataLine + '\n' 77 | header = header + '\n' 78 | self.st.insert('end', dataLine) 79 | self.st.component('rowheader').insert('end', header) 80 | self.st.tag_add(*('yellow',) + tuple(tagList)) 81 | 82 | # Prevent users' modifying text and headers 83 | self.st.configure( 84 | text_state = 'disabled', 85 | Header_state = 'disabled', 86 | ) 87 | 88 | ###################################################################### 89 | 90 | # Create demo in root window for testing. 91 | if __name__ == '__main__': 92 | root = tkinter.Tk() 93 | Pmw.initialise(root) 94 | root.title(title) 95 | 96 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 97 | exitButton.pack(side = 'bottom') 98 | widget = Demo(root) 99 | root.mainloop() 100 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ScrolledText_2.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.ScrolledText demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import os 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | # Create the ScrolledText. 14 | self.st = Pmw.ScrolledText(parent, 15 | borderframe = 1, 16 | labelpos = 'n', 17 | label_text='ScrolledText.py', 18 | usehullsize = 1, 19 | hull_width = 400, 20 | hull_height = 300, 21 | text_padx = 10, 22 | text_pady = 10, 23 | text_wrap='none' 24 | ) 25 | 26 | # Create a group widget to contain the scrollmode options. 27 | w = Pmw.Group(parent, tag_text='Scroll mode') 28 | w.pack(side = 'bottom', padx = 5, pady = 5) 29 | 30 | hmode = Pmw.OptionMenu(w.interior(), 31 | labelpos = 'w', 32 | label_text = 'Horizontal:', 33 | items = ['none', 'static', 'dynamic'], 34 | command = self.sethscrollmode, 35 | menubutton_width = 8, 36 | ) 37 | hmode.pack(side = 'left', padx = 5, pady = 5) 38 | hmode.invoke('dynamic') 39 | 40 | vmode = Pmw.OptionMenu(w.interior(), 41 | labelpos = 'w', 42 | label_text = 'Vertical:', 43 | items = ['none', 'static', 'dynamic'], 44 | command = self.setvscrollmode, 45 | menubutton_width = 8, 46 | ) 47 | vmode.pack(side = 'left', padx = 5, pady = 5) 48 | vmode.invoke('dynamic') 49 | 50 | buttonBox = Pmw.ButtonBox(parent) 51 | buttonBox.pack(side = 'bottom') 52 | buttonBox.add('yview', text = 'Show\nyview', command = self.showYView) 53 | buttonBox.add('scroll', text = 'Page\ndown', command = self.pageDown) 54 | buttonBox.add('center', text = 'Center', command = self.centerPage) 55 | 56 | # Pack this last so that the buttons do not get shrunk when 57 | # the window is resized. 58 | self.st.pack(padx = 5, pady = 5, fill = 'both', expand = 1) 59 | 60 | # Read this file into the text widget. 61 | head, tail = os.path.split(sys.argv[0]) 62 | self.st.importfile(os.path.join(head,'ScrolledText.py')) 63 | 64 | self.st.insert('end', '\nThis demonstrates how to\n' + 65 | 'add a window to a text widget: ') 66 | counter = Pmw.Counter(self.st.component('text'), 67 | entryfield_value = 9999) 68 | self.st.window_create('end', window = counter) 69 | 70 | def sethscrollmode(self, tag): 71 | self.st.configure(hscrollmode = tag) 72 | 73 | def setvscrollmode(self, tag): 74 | self.st.configure(vscrollmode = tag) 75 | 76 | def showYView(self): 77 | print((self.st.yview())) 78 | 79 | def pageDown(self): 80 | self.st.yview('scroll', 1, 'page') 81 | 82 | def centerPage(self): 83 | top, bottom = self.st.yview() 84 | size = bottom - top 85 | middle = 0.5 - size / 2 86 | self.st.yview('moveto', middle) 87 | 88 | ###################################################################### 89 | 90 | # Create demo in root window for testing. 91 | if __name__ == '__main__': 92 | root = tkinter.Tk() 93 | Pmw.initialise(root) 94 | root.title(title) 95 | 96 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 97 | exitButton.pack(side = 'bottom') 98 | widget = Demo(root) 99 | root.mainloop() 100 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/SelectionDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.SelectionDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create the dialog. 13 | self.dialog = Pmw.SelectionDialog(parent, 14 | title = 'My SelectionDialog', 15 | buttons = ('OK', 'Cancel'), 16 | defaultbutton = 'OK', 17 | scrolledlist_labelpos = 'n', 18 | label_text = 'What do you think of Pmw?', 19 | scrolledlist_items = ('Cool man', 'Cool', 'Good', 'Bad', 'Gross'), 20 | command = self.execute) 21 | self.dialog.withdraw() 22 | 23 | # Create button to launch the dialog. 24 | w = tkinter.Button(parent, text = 'Show selection dialog', 25 | command = self.dialog.activate) 26 | w.pack(padx = 8, pady = 8) 27 | 28 | def execute(self, result): 29 | sels = self.dialog.getcurselection() 30 | if len(sels) == 0: 31 | print(('You clicked on', result, '(no selection)')) 32 | else: 33 | print(('You clicked on', result, sels[0])) 34 | self.dialog.deactivate(result) 35 | 36 | ###################################################################### 37 | 38 | # Create demo in root window for testing. 39 | if __name__ == '__main__': 40 | root = tkinter.Tk() 41 | Pmw.initialise(root) 42 | root.title(title) 43 | 44 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 45 | exitButton.pack(side = 'bottom') 46 | widget = Demo(root) 47 | root.mainloop() 48 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/ShowBusy.py: -------------------------------------------------------------------------------- 1 | title = 'Blt busy cursor demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | self.parent = parent 13 | 14 | if Pmw.Blt.havebltbusy(parent): 15 | text = 'Click here to show the\nbusy cursor for one second.' 16 | else: 17 | text = 'Sorry\n' \ 18 | 'Either the BLT package has not\n' \ 19 | 'been installed on this system or\n' \ 20 | 'it does not support the busy command.\n' \ 21 | 'Clicking on this button will pause\n' \ 22 | 'for one second but will not display\n' \ 23 | 'the busy cursor.' 24 | 25 | button = tkinter.Button(parent, 26 | text = text, 27 | command = Pmw.busycallback(self.sleep, parent.update)) 28 | button.pack(padx = 10, pady = 10) 29 | 30 | entry = tkinter.Entry(parent, width = 30) 31 | entry.insert('end', 'Try to enter some text while busy.') 32 | entry.pack(padx = 10, pady = 10) 33 | 34 | def sleep(self): 35 | self.parent.after(1000) 36 | 37 | ###################################################################### 38 | 39 | # Create demo in root window for testing. 40 | if __name__ == '__main__': 41 | root = tkinter.Tk() 42 | Pmw.initialise(root) 43 | root.title(title) 44 | 45 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 46 | exitButton.pack(side = 'bottom') 47 | widget = Demo(root) 48 | root.mainloop() 49 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/SpecialCounter.py: -------------------------------------------------------------------------------- 1 | title = 'Subclassing Pmw.Counter' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import time 9 | import types 10 | import tkinter 11 | import Pmw 12 | 13 | class LabeledDateCounter(Pmw.Counter): 14 | 15 | def __init__(self, parent=None , **kw): 16 | 17 | # Need to use long ints here because on the Macintosh the maximum size 18 | # of an integer is smaller than the value returned by time.time(). 19 | now = (int(time.time()) / 300) * 300 20 | text = time.strftime('%y/%m/%d', time.localtime(now)) 21 | 22 | kw['datatype'] = 'date' 23 | kw['entryfield_validate'] = 'date' 24 | kw['entryfield_value'] = text 25 | kw['labelpos'] = 'w' 26 | 27 | Pmw.Counter.__init__(*(self, parent), **kw) 28 | 29 | class LabeledRealCounter(Pmw.Counter): 30 | 31 | def __init__(self, parent=None , **kw): 32 | 33 | # Define the validate option dictionary. 34 | validate = {'validator' : 'real', 'min' : 0.0, 'max' : 100.0} 35 | 36 | kw['datatype'] = 'real' 37 | kw['entryfield_validate'] = validate 38 | kw['entryfield_value'] = 50.0 39 | kw['labelpos'] = 'w' 40 | 41 | Pmw.Counter.__init__(*(self, parent), **kw) 42 | 43 | class Demo: 44 | def __init__(self, parent): 45 | # Create and pack some LabeledDateCounters and LabeledRealCounter. 46 | self._date1 = LabeledDateCounter(parent, label_text = 'Date:') 47 | self._date2 = LabeledDateCounter(parent, label_text = 'Another Date:') 48 | self._real1 = LabeledRealCounter(parent, label_text = 'Real:') 49 | self._real2 = LabeledRealCounter(parent, label_text = 'Another Real:') 50 | 51 | counters = (self._date1, self._date2, self._real1, self._real2) 52 | 53 | for counter in counters: 54 | counter.pack(fill='x', expand=1, padx=10, pady=5) 55 | Pmw.alignlabels(counters) 56 | 57 | ###################################################################### 58 | 59 | # Create demo in root window for testing. 60 | if __name__ == '__main__': 61 | root = tkinter.Tk() 62 | Pmw.initialise(root) 63 | root.title(title) 64 | 65 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 66 | exitButton.pack(side = 'bottom') 67 | widget = Demo(root) 68 | root.mainloop() 69 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/SpeedTest.py: -------------------------------------------------------------------------------- 1 | title = 'Test of the speed of creating Pmw megawidgets' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import time 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | self.parent = parent 14 | 15 | message = 'This is a test of the time\n' + \ 16 | 'it takes to create 20 Pmw\nEntryField megawidgets.\n' + \ 17 | 'Click on the button to create them.' 18 | w = tkinter.Label(parent, text = message) 19 | w.pack(padx = 8, pady = 8) 20 | 21 | # Create button to run speed test. 22 | w = tkinter.Button(parent, 23 | text = 'Create 20 EntryFields', 24 | command = self.createEntries) 25 | w.pack(padx = 8, pady = 8) 26 | 27 | def createEntries(self): 28 | entryTop = tkinter.Toplevel(self.parent) 29 | 30 | startClock = time.clock() 31 | fields = [] 32 | for num in range(20): 33 | field = Pmw.EntryField(entryTop, 34 | labelpos = 'w', 35 | label_text='*' + ('*' * num), 36 | hull_background = 'lightsteelblue', 37 | label_background = 'lightsteelblue', 38 | hull_highlightbackground = 'lightsteelblue', 39 | label_highlightbackground = 'lightsteelblue', 40 | entry_highlightbackground = 'lightsteelblue', 41 | entry_background = 'aliceblue') 42 | field.pack() 43 | fields.append(field) 44 | 45 | Pmw.alignlabels(fields) 46 | print(('Time to create 20 EntryFields:', \ 47 | time.clock() - startClock, 'seconds')) 48 | 49 | ###################################################################### 50 | 51 | # Create demo in root window for testing. 52 | if __name__ == '__main__': 53 | root = tkinter.Tk() 54 | Pmw.initialise(root) 55 | root.title(title) 56 | 57 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 58 | exitButton.pack(side = 'bottom') 59 | widget = Demo(root) 60 | root.mainloop() 61 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/TextDialog.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.TextDialog demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create the dialog. 13 | dialog = Pmw.TextDialog(parent, scrolledtext_labelpos = 'n', 14 | title = 'My TextDialog', 15 | defaultbutton = 0, 16 | label_text = 'Lawyer jokes') 17 | dialog.withdraw() 18 | dialog.insert('end', jokes) 19 | dialog.configure(text_state = 'disabled') 20 | 21 | # Create button to launch the dialog. 22 | w = tkinter.Button(parent, text = 'Show text dialog', 23 | command = dialog.activate) 24 | w.pack(padx = 8, pady = 8) 25 | 26 | jokes = """ 27 | Q: What do you call 5000 dead lawyers at the bottom of the ocean? 28 | A: A good start! 29 | 30 | Q: How can you tell when a lawyer is lying? 31 | A: His lips are moving. 32 | 33 | Q: Why won't sharks attack lawyers? 34 | A: Professional courtesy. 35 | 36 | Q: What do have when a lawyer is buried up to his neck in sand? 37 | A: Not enough sand. 38 | 39 | Q: How do you get a lawyer out of a tree? 40 | A: Cut the rope. 41 | 42 | Q: What is the definition of a shame (as in "that's a shame")? 43 | A: When a bus load of lawyers goes off a cliff. 44 | 45 | Q: What is the definition of a "crying shame"? 46 | A: There was an empty seat. 47 | 48 | Q: What do you get when you cross the Godfather with a lawyer? 49 | A: An offer you can't understand. 50 | 51 | Q. What do lawyers use as contraceptives? 52 | A. Their personalities. 53 | 54 | Q. What's brown and black and looks good on a lawyer? 55 | A. A doberman. 56 | 57 | Q. Why are lawyers buried 12 feet underground? 58 | A. Deep down their good. 59 | 60 | Q. What's the difference between a catfish and a lawyer? 61 | A. One's a slimy scum-sucking scavenger, the other is just a fish. 62 | 63 | """ 64 | ###################################################################### 65 | 66 | # Create demo in root window for testing. 67 | if __name__ == '__main__': 68 | root = tkinter.Tk() 69 | Pmw.initialise(root) 70 | root.title(title) 71 | 72 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 73 | exitButton.pack(side = 'bottom') 74 | widget = Demo(root) 75 | root.mainloop() 76 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/TextDisplay.py: -------------------------------------------------------------------------------- 1 | title = 'Demonstration of how to create a megawidget' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class TextDisplay(Pmw.MegaWidget): 11 | 12 | # Demo Pmw megawidget. 13 | 14 | def __init__(self, parent = None, **kw): 15 | 16 | # Define the megawidget options. 17 | optiondefs = () 18 | self.defineoptions(kw, optiondefs) 19 | 20 | # Initialise the base class (after defining the options). 21 | Pmw.MegaWidget.__init__(self, parent) 22 | 23 | # Create the components. 24 | interior = self.interior() 25 | 26 | self._text = self.createcomponent('text', 27 | (), None, 28 | tkinter.Text, (interior,), state = 'disabled') 29 | self._text.pack(side='left', fill='both', expand='yes') 30 | 31 | self._scrollbar = self.createcomponent('scrollbar', 32 | (), None, 33 | tkinter.Scrollbar, (interior,), command = self._text.yview) 34 | self._scrollbar.pack(side='right', fill='y') 35 | self._text.configure(yscrollcommand = self._scrollbar.set) 36 | 37 | # Check keywords and initialise options. 38 | self.initialiseoptions() 39 | 40 | def display(self, info): 41 | self._text.configure(state = 'normal') 42 | self._text.delete('1.0', 'end') 43 | self._text.insert('1.0', info) 44 | self._text.configure(state = 'disabled') 45 | 46 | def append(self, info): 47 | self._text.configure(state = 'normal') 48 | self._text.insert('end', info) 49 | self._text.configure(state = 'disabled') 50 | 51 | class Demo: 52 | def __init__(self, parent): 53 | # Create and pack the megawidget. 54 | text = TextDisplay(parent, 55 | text_background = 'aliceblue', 56 | text_width = 40, 57 | text_height = 10, 58 | text_wrap = 'none', 59 | ) 60 | text.pack(fill = 'both', expand = 1) 61 | text.display('This is an example of a simple Pmw megawidget.\n\n' + 62 | 'Public attributes of the Tkinter module:\n\n') 63 | for name in dir(tkinter): 64 | if name[0] != '_': 65 | text.append(' ' + name + '\n') 66 | 67 | ###################################################################### 68 | 69 | # Create demo in root window for testing. 70 | if __name__ == '__main__': 71 | root = tkinter.Tk() 72 | Pmw.initialise(root) 73 | root.title(title) 74 | 75 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 76 | exitButton.pack(side = 'bottom') 77 | widget = Demo(root) 78 | root.mainloop() 79 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/TimeCounter.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.TimeCounter demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import string 8 | import tkinter 9 | import Pmw 10 | 11 | class Demo: 12 | def __init__(self, parent): 13 | self._time = Pmw.TimeCounter(parent, 14 | labelpos = 'w', 15 | label_text = 'HH:MM:SS', 16 | min = '00:00:00', 17 | max = '23:59:59') 18 | self._time.pack(padx=10, pady=5) 19 | 20 | button = tkinter.Button(parent, text = 'Show', command = self.show) 21 | button.pack() 22 | 23 | def show(self): 24 | stringVal = self._time.getstring() 25 | intVal = self._time.getint() 26 | print((stringVal + ' (' + str(intVal) + ')')) 27 | 28 | 29 | ###################################################################### 30 | 31 | # Create demo in root window for testing. 32 | if __name__ == '__main__': 33 | root = tkinter.Tk() 34 | Pmw.initialise(root) 35 | root.title(title) 36 | 37 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 38 | exitButton.pack(side = 'bottom') 39 | widget = Demo(root) 40 | root.mainloop() 41 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/demos/WidgetDestroy.py: -------------------------------------------------------------------------------- 1 | title = 'Demonstration of Pmw megawidget destruction' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | # Create and pack an EntryField. 13 | self.entryfield = Pmw.EntryField(parent, 14 | command = self.execute, 15 | value = 'Press to destroy me', 16 | entry_width = 30) 17 | self.entryfield.pack(fill='x', expand=1, padx=10, pady=5) 18 | 19 | self.entryfield.component('entry').focus_set() 20 | 21 | def execute(self): 22 | print('Return pressed, destroying EntryField.') 23 | self.entryfield.destroy() 24 | 25 | ###################################################################### 26 | 27 | # Create demo in root window for testing. 28 | if __name__ == '__main__': 29 | root = tkinter.Tk() 30 | Pmw.initialise(root) 31 | root.title(title) 32 | 33 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 34 | exitButton.pack(side = 'bottom') 35 | widget = Demo(root) 36 | root.mainloop() 37 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/AboutDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/AboutDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/Balloon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/Balloon.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ButtonBox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ButtonBox.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ComboBox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ComboBox.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ComboBoxDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ComboBoxDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/Counter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/Counter.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/CounterDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/CounterDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/Dialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/Dialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/EntryField.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/EntryField.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ExampleDemo.py: -------------------------------------------------------------------------------- 1 | title = 'Pmw.EXAMPLE demonstration' 2 | 3 | # Import Pmw from this directory tree. 4 | import sys 5 | sys.path[:0] = ['../../..'] 6 | 7 | import tkinter 8 | import Pmw 9 | 10 | class Demo: 11 | def __init__(self, parent): 12 | 13 | # Create and pack the EXAMPLEs. 14 | self.widget1 = Pmw.Counter(parent) 15 | self.widget1.setentry('1') 16 | self.widget1.pack() 17 | 18 | self.widget2 = Pmw.Counter(parent, increment = 10) 19 | self.widget2.setentry('100') 20 | self.widget2.pack() 21 | 22 | ###################################################################### 23 | 24 | # Create demo in root window for testing. 25 | if __name__ == '__main__': 26 | root = tkinter.Tk() 27 | Pmw.initialise(root) 28 | root.title(title) 29 | 30 | exitButton = tkinter.Button(root, text = 'Exit', command = root.destroy) 31 | exitButton.pack(side = 'bottom') 32 | widget = Demo(root) 33 | root.mainloop() 34 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/Group.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/Group.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/HistoryText.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/HistoryText.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/LabeledWidget.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/LabeledWidget.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/MainMenuBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/MainMenuBar.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/MegaWidget.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pmw.MegaWidget reference manual 7 | 8 | 9 | 11 | 12 |

Pmw.MegaWidget

13 | 14 |
15 |

Name

16 |

Pmw.MegaWidget() - 17 | base class for megawidgets within a frame 18 |

19 | 20 | 21 |
22 |

Inherits

23 | Pmw.MegaArchetype
24 |
25 |

Description

26 |

27 | This class creates a megawidget contained within a Tkinter.Frame 28 | window. The class acts as the base class for megawidgets that are 29 | not contained in their own toplevel window, such as Pmw.ButtonBox and 30 | Pmw.ComboBox. It creates a Tkinter.Frame component, named hull, 31 | to act as the container of the megawidget. The window class name 32 | for the hull widget is set to the most-specific class name for 33 | the megawidget. Derived classes specialise this class by 34 | creating other widget components as children of the hull widget.

35 | 36 |

37 | 38 | 39 |
40 |

Components

41 | Components created by this megawidget and its base 42 | classes are described below.

43 | 44 |
hull 45 |
46 | This acts as the body for the entire megawidget. Other components 47 | are created as children of the hull to further specialise this 48 | class. By default, this component is a Tkinter.Frame.

49 | 50 | 51 |
52 |
53 | 54 |

Methods

55 | This megawidget has no methods of its own. 56 | For a description of its inherited methods, see the 57 | manual for its base class 58 | Pmw.MegaArchetype. 59 | In addition, methods from the 60 | Tkinter.Frame class 61 | are forwarded by this megawidget to the 62 | hull component. 63 |

64 |
65 |
66 | 67 |

68 | 69 |

70 | 71 | 72 | 73 |

74 | Pmw 2.0.0 - 75 | 29 Mar 2014 76 | - Home 77 |
Manual page last reviewed: 22 May 1998 78 |

79 |
80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/MenuBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/MenuBar.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/MessageBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/MessageBar.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/MessageDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/MessageDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/NoteBook.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/NoteBook.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/OptionMenu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/OptionMenu.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/PanedWidget.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/PanedWidget.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/PromptDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/PromptDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/RadioSelect.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/RadioSelect.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledCanvas.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ScrolledCanvas.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledField.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ScrolledField.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledFrame.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ScrolledFrame.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledListBox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ScrolledListBox.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledText.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/ScrolledText.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/ScrolledText_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/scrolledtext.test code. 2 | 3 | import Test 4 | import Pmw 5 | 6 | Test.initialise() 7 | 8 | c = Pmw.ScrolledText 9 | 10 | def _testYView(doBottom): 11 | w = Test.currentWidget() 12 | top, bottom = w.yview() 13 | if type(top) != type(0.0) or type(bottom) != type(0.0): 14 | return 'bad type ' + str(top) + ' ' + str(bottom) 15 | if doBottom: 16 | if bottom != 1.0: 17 | return 'bottom is ' + str(bottom) 18 | else: 19 | if top != 0.0: 20 | return 'top is ' + str(top) 21 | 22 | kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledText'} 23 | tests_1 = ( 24 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 25 | (Test.num_options, (), 10), 26 | (c.importfile, 'ScrolledText_test.py'), 27 | ('hull_background', 'aliceblue'), 28 | ('text_borderwidth', 3), 29 | ('Scrollbar_borderwidth', 3), 30 | ('hull_cursor', 'gumby'), 31 | ('text_exportselection', 0), 32 | ('text_exportselection', 1), 33 | ('text_foreground', 'Black'), 34 | ('text_height', 10), 35 | ('text_width', 20), 36 | ('text_insertbackground', 'Black'), 37 | ('text_insertborderwidth', 1), 38 | ('text_insertofftime', 200), 39 | ('text_insertontime', 500), 40 | ('text_insertwidth', 3), 41 | ('label_text', 'Label'), 42 | ('text_relief', 'raised'), 43 | ('text_relief', 'sunken'), 44 | ('Scrollbar_repeatdelay', 200), 45 | ('Scrollbar_repeatinterval', 105), 46 | ('vscrollmode', 'none'), 47 | ('vscrollmode', 'static'), 48 | ('vscrollmode', 'dynamic'), 49 | ('hscrollmode', 'none'), 50 | ('hscrollmode', 'static'), 51 | ('hscrollmode', 'dynamic'), 52 | ('Scrollbar_width', 20), 53 | ('text_selectborderwidth', 2), 54 | ('text_state', 'disabled'), 55 | ('text_state', 'normal'), 56 | ('text_background', 'GhostWhite'), 57 | ('text_wrap', 'char'), 58 | ('text_wrap', 'none'), 59 | ('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' + 60 | 'option "bogus": should be static, dynamic, or none'), 61 | ('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' + 62 | 'option "bogus": should be static, dynamic, or none'), 63 | (c.cget, 'vscrollmode', 'bogus'), 64 | (c.cget, 'hscrollmode', 'bogus'), 65 | ('vscrollmode', 'dynamic'), 66 | ('hscrollmode', 'dynamic'), 67 | (c.insert, ('end', 'Hello there\n')), 68 | (_testYView, 0), 69 | (c.yview, ('moveto', 0.02)), 70 | (c.yview, ('moveto', 0.04)), 71 | (c.yview, ('moveto', 0.06)), 72 | (c.yview, ('moveto', 0.08)), 73 | (c.yview, ('moveto', 0.10)), 74 | (c.yview, ('moveto', 0.12)), 75 | (c.yview, ('moveto', 0.14)), 76 | (c.yview, ('moveto', 0.16)), 77 | (c.yview, ('moveto', 0.18)), 78 | (c.yview, ('moveto', 0.20)), 79 | (c.yview, ('moveto', 0.22)), 80 | (c.yview, ('moveto', 0.24)), 81 | (c.yview, ('moveto', 0.26)), 82 | (c.yview, ('moveto', 0.28)), 83 | (c.yview, ('moveto', 0.98)), 84 | (_testYView, 1), 85 | (c.yview, ('scroll', -1, 'page')), 86 | (c.yview, ('scroll', -50, 'page')), 87 | (_testYView, 0), 88 | (c.yview, ('scroll', 1, 'page')), 89 | (c.yview, ('scroll', 50, 'page')), 90 | (_testYView, 1), 91 | (c.clear, ()), 92 | (c.get, (), '\n'), 93 | ) 94 | 95 | kw_2 = { 96 | 'hscrollmode' : 'dynamic', 97 | 'label_text' : 'Label', 98 | 'labelpos' : 'n', 99 | 'scrollmargin': 20, 100 | } 101 | tests_2 = ( 102 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 103 | (c.importfile, 'ScrolledText_test.py'), 104 | ('text_relief', 'raised'), 105 | ('text_relief', 'sunken'), 106 | ) 107 | 108 | alltests = ( 109 | (tests_1, kw_1), 110 | (tests_2, kw_2), 111 | ) 112 | 113 | testData = ((Pmw.ScrolledText, alltests),) 114 | 115 | if __name__ == '__main__': 116 | Test.runTests(testData) 117 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/SelectionDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/SelectionDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/TextDialog.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/TextDialog.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/TimeCounter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/TimeCounter.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/blue_line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/blue_line.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/blueball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/blueball.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/copyright.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pmw copyright 7 | 8 | 9 | 11 | 12 |

Pmw copyright

13 | 14 |

15 | Copyright 1997-1999 Telstra Corporation Limited, Australia 16 | Copyright 2000-2002 Really Good Software Pty Ltd, Australia

17 | 18 |

Permission is hereby granted, free of charge, to any person 19 | obtaining a copy of this software and associated documentation 20 | files (the "Software"), to deal in the Software without 21 | restriction, including without limitation the rights to use, copy, 22 | modify, merge, publish, distribute, sublicense, and/or sell copies 23 | of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions:

25 | 26 |

The above copyright notice and this permission notice shall be 27 | included in all copies or substantial portions of the Software.

28 | 29 |

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 30 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 31 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 32 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 33 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 34 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 36 | DEALINGS IN THE SOFTWARE. 37 |

38 | 39 | 40 | 41 |

42 | 43 |

44 | 45 | 46 | 47 |

48 | Pmw 2.0.0 - 49 | 29 Mar 2014 50 | - Home 51 | 52 |

53 |
54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/counter1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/counter1.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/counter2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/counter2.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/example.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Pmw 3 | 4 | class ThresholdScale(Pmw.MegaWidget): 5 | """ Megawidget containing a scale and an indicator. 6 | """ 7 | 8 | def __init__(self, parent = None, **kw): 9 | 10 | # Define the megawidget options. 11 | optiondefs = ( 12 | ('colors', ('green', 'red'), None), 13 | ('threshold', 50, None), 14 | ('value', None, Pmw.INITOPT), 15 | ) 16 | self.defineoptions(kw, optiondefs) 17 | 18 | # Initialise base class (after defining options). 19 | Pmw.MegaWidget.__init__(self, parent) 20 | 21 | # Create the components. 22 | interior = self.interior() 23 | 24 | # Create the indicator component. 25 | self.indicator = self.createcomponent('indicator', 26 | (), None, 27 | tkinter.Frame, interior, 28 | width = 16, 29 | height = 16, 30 | borderwidth = 2, 31 | relief = 'raised') 32 | self.indicator.grid() 33 | 34 | # Create the scale component. 35 | self.scale = self.createcomponent('scale', 36 | (), None, 37 | tkinter.Scale, interior, 38 | command = self._doCommand, 39 | tickinterval = 20, 40 | length = 200, 41 | from_ = 100, 42 | to = 0, 43 | showvalue = 0) 44 | self.scale.grid() 45 | 46 | value = self['value'] 47 | if value is not None: 48 | self.scale.set(value) 49 | 50 | # Check keywords and initialise options. 51 | self.initialiseoptions() 52 | 53 | def _doCommand(self, valueStr): 54 | if self.scale.get() > self['threshold']: 55 | color = self['colors'][1] 56 | else: 57 | color = self['colors'][0] 58 | self.indicator.configure(background = color) 59 | 60 | Pmw.forwardmethods(ThresholdScale, tkinter.Scale, 'scale') 61 | 62 | # Initialise Tkinter and Pmw. 63 | root = Pmw.initialise() 64 | root.title('Pmw ThresholdScale demonstration') 65 | 66 | # Create and pack two ThresholdScale megawidgets. 67 | mega1 = ThresholdScale() 68 | mega1.pack(side = 'left', padx = 10, pady = 10) 69 | 70 | mega2 = ThresholdScale( 71 | colors = ('green', 'yellow'), 72 | threshold = 75, 73 | value = 80, 74 | indicator_width = 32, 75 | scale_width = 25) 76 | mega2.pack(side = 'left', padx = 10, pady = 10) 77 | 78 | # Let's go. 79 | root.mainloop() 80 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/example1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/example1.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/example2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/example2.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/features.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pmw features 7 | 8 | 9 | 11 | 12 |

Pmw features

13 | 14 |

15 | Pmw is a toolkit for building high-level compound widgets, or 16 | megawidgets, constructed using other widgets as component parts. 17 | It promotes consistent look and feel within and between graphical 18 | applications, is highly configurable to your needs and is easy to 19 | use.

20 | 21 |

Pmw consists of:

22 |
  • A few base classes, providing a foundation for building 23 | megawidgets.

    24 | 25 |
  • 26 |
  • A library of flexible and extensible megawidgets built on 27 | the base classes, such as buttonboxes, notebooks, 28 | comboboxes, selection widgets, paned widgets, scrolled 29 | widgets and dialog windows.

    30 | 31 |
  • 32 |
  • A lazy importer/dynamic loader which is automatically 33 | invoked when Pmw is first imported. This gives unified 34 | access to all Pmw classes and functions through the Pmw. 35 | prefix. It also speeds up module loading time by only 36 | importing Pmw sub-modules when needed.

    37 | 38 |
  • 39 |
  • Complete reference documentation, covering all classes and 40 | functions including all megawidgets and their options, 41 | methods and components. Helpful tutorial material is also 42 | available.

    43 | 44 |
  • 45 |
  • A test framework and tests for Pmw megawidgets.

    46 | 47 |
  • 48 |
  • A slick demonstration of the megawidgets.

    49 | 50 |
  • 51 |
  • An interface to the BLT busy, graph and vector commands.

    52 | 53 |
54 | 55 |

The interface to Pmw megawidgets is similar to basic Tk widgets, so it 56 | is easy for developers to include both megawidgets and basic Tk 57 | widgets in their graphical applications. In addition, Pmw 58 | megawidgets may themselves be extended, using either inheritance or 59 | composition.

60 | 61 |

The use of the Pmw megawidgets replaces common widget combinations 62 | with higher level abstractions. This simplifies code, making it 63 | more readable and maintainable. The ability to extend Pmw 64 | megawidgets enables developers to create new megawidgets based on 65 | previous work.

66 | 67 |

68 | 69 | 70 | 71 |

72 | 73 |

74 | 75 | 76 | 77 |

78 | Pmw 2.0.0 - 79 | 29 Mar 2014 80 | - Home 81 | 82 |

83 |
84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/halfblueball.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/halfblueball.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/scale1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/scale1.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/scale2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/scale2.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/doc/transdove.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/doc/transdove.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/Pmw.def: -------------------------------------------------------------------------------- 1 | # [Emacs: -*- python -*-] 2 | # --- This is the Pmw definition file --- 3 | # 4 | # It is invoked by the Pmw dynamic loader in Pmw.__init__. 5 | # 6 | # widgets : tuple with the names of those widget classes that are 7 | # stacked in a module of the same name. 8 | # widgetclasses : dictionary from names of widget classes to module names. 9 | # functions : dictionary from function names to modules names. 10 | # modules : tuple of module names that don't contain widget classes 11 | # of the same name. 12 | # 13 | 14 | # Widgets whose name is the same as its module. 15 | _widgets = ( 16 | 'AboutDialog', 'Balloon', 'ButtonBox', 'ComboBox', 17 | 'ComboBoxDialog', 'Counter', 'CounterDialog', 'Dialog', 18 | 'EntryField', 'Group', 'HistoryText', 'LabeledWidget', 19 | 'MainMenuBar', 'MenuBar', 'MessageBar', 20 | 'MessageDialog', 'NoteBook', 'OptionMenu', 'PanedWidget', 21 | 'PromptDialog', 'RadioSelect', 'ScrolledCanvas', 'ScrolledField', 22 | 'ScrolledFrame', 'ScrolledListBox', 'ScrolledText', 'SelectionDialog', 23 | 'TextDialog', 'TimeCounter', 24 | ) 25 | 26 | # Widgets whose name is not the same as its module. 27 | _extraWidgets = { 28 | } 29 | 30 | _functions = { 31 | 'logicalfont' : 'LogicalFont', 32 | 'logicalfontnames' : 'LogicalFont', 33 | 'aboutversion' : 'AboutDialog', 34 | 'aboutcopyright' : 'AboutDialog', 35 | 'aboutcontact' : 'AboutDialog', 36 | 'datestringtojdn' : 'TimeFuncs', 37 | 'timestringtoseconds' : 'TimeFuncs', 38 | 'setyearpivot' : 'TimeFuncs', 39 | 'ymdtojdn' : 'TimeFuncs', 40 | 'jdntoymd' : 'TimeFuncs', 41 | 'stringtoreal' : 'TimeFuncs', 42 | 'aligngrouptags' : 'Group', 43 | 'OK' : 'EntryField', 44 | 'ERROR' : 'EntryField', 45 | 'PARTIAL' : 'EntryField', 46 | 'numericvalidator' : 'EntryField', 47 | 'integervalidator' : 'EntryField', 48 | 'hexadecimalvalidator' : 'EntryField', 49 | 'realvalidator' : 'EntryField', 50 | 'alphabeticvalidator' : 'EntryField', 51 | 'alphanumericvalidator' : 'EntryField', 52 | 'timevalidator' : 'EntryField', 53 | 'datevalidator' : 'EntryField', 54 | } 55 | 56 | _modules = ( 57 | 'Color', 'Blt', 58 | ) 59 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwAboutDialog.py: -------------------------------------------------------------------------------- 1 | import Pmw 2 | 3 | class AboutDialog(Pmw.MessageDialog): 4 | # Window to display version and contact information. 5 | 6 | # Class members containing resettable 'default' values: 7 | _version = '' 8 | _copyright = '' 9 | _contact = '' 10 | 11 | def __init__(self, parent = None, **kw): 12 | 13 | # Define the megawidget options. 14 | INITOPT = Pmw.INITOPT 15 | optiondefs = ( 16 | ('applicationname', '', INITOPT), 17 | ('iconpos', 'w', None), 18 | ('icon_bitmap', 'info', None), 19 | ('buttons', ('Close',), None), 20 | ('defaultbutton', 0, None), 21 | ) 22 | self.defineoptions(kw, optiondefs) 23 | 24 | # Initialise the base class (after defining the options). 25 | Pmw.MessageDialog.__init__(self, parent) 26 | 27 | applicationname = self['applicationname'] 28 | if 'title' not in kw: 29 | self.configure(title = 'About ' + applicationname) 30 | 31 | if 'message_text' not in kw: 32 | text = applicationname + '\n\n' 33 | if AboutDialog._version != '': 34 | text = text + 'Version ' + AboutDialog._version + '\n' 35 | if AboutDialog._copyright != '': 36 | text = text + AboutDialog._copyright + '\n\n' 37 | if AboutDialog._contact != '': 38 | text = text + AboutDialog._contact 39 | 40 | self.configure(message_text=text) 41 | 42 | # Check keywords and initialise options. 43 | self.initialiseoptions() 44 | 45 | def aboutversion(value): 46 | AboutDialog._version = value 47 | 48 | def aboutcopyright(value): 49 | AboutDialog._copyright = value 50 | 51 | def aboutcontact(value): 52 | AboutDialog._contact = value 53 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwComboBoxDialog.py: -------------------------------------------------------------------------------- 1 | # Not Based on iwidgets version. 2 | 3 | import Pmw 4 | 5 | class ComboBoxDialog(Pmw.Dialog): 6 | # Dialog window with simple combobox. 7 | 8 | # Dialog window displaying a list and entry field and requesting 9 | # the user to make a selection or enter a value 10 | 11 | def __init__(self, parent = None, **kw): 12 | # Define the megawidget options. 13 | INITOPT = Pmw.INITOPT 14 | optiondefs = ( 15 | ('borderx', 10, INITOPT), 16 | ('bordery', 10, INITOPT), 17 | ) 18 | self.defineoptions(kw, optiondefs) 19 | 20 | # Initialise the base class (after defining the options). 21 | Pmw.Dialog.__init__(self, parent) 22 | 23 | # Create the components. 24 | interior = self.interior() 25 | 26 | aliases = ( 27 | ('listbox', 'combobox_listbox'), 28 | ('scrolledlist', 'combobox_scrolledlist'), 29 | ('entry', 'combobox_entry'), 30 | ('label', 'combobox_label'), 31 | ) 32 | self._combobox = self.createcomponent('combobox', 33 | aliases, None, 34 | Pmw.ComboBox, (interior,), 35 | scrolledlist_dblclickcommand = self.invoke, 36 | dropdown = 0, 37 | ) 38 | self._combobox.pack(side='top', expand='true', fill='both', 39 | padx = self['borderx'], pady = self['bordery']) 40 | 41 | if 'activatecommand' not in kw: 42 | # Whenever this dialog is activated, set the focus to the 43 | # ComboBox's listbox widget. 44 | listbox = self.component('listbox') 45 | self.configure(activatecommand = listbox.focus_set) 46 | 47 | # Check keywords and initialise options. 48 | self.initialiseoptions() 49 | 50 | # Need to explicitly forward this to override the stupid 51 | # (grid_)size method inherited from Tkinter.Toplevel.Grid. 52 | def size(self): 53 | return self._combobox.size() 54 | 55 | # Need to explicitly forward this to override the stupid 56 | # (grid_)bbox method inherited from Tkinter.Toplevel.Grid. 57 | def bbox(self, index): 58 | return self._combobox.bbox(index) 59 | 60 | Pmw.forwardmethods(ComboBoxDialog, Pmw.ComboBox, '_combobox') 61 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwCounterDialog.py: -------------------------------------------------------------------------------- 1 | import Pmw 2 | 3 | # A Dialog with a counter 4 | 5 | class CounterDialog(Pmw.Dialog): 6 | 7 | def __init__(self, parent = None, **kw): 8 | 9 | # Define the megawidget options. 10 | INITOPT = Pmw.INITOPT 11 | optiondefs = ( 12 | ('borderx', 20, INITOPT), 13 | ('bordery', 20, INITOPT), 14 | ) 15 | self.defineoptions(kw, optiondefs) 16 | 17 | # Initialise the base class (after defining the options). 18 | Pmw.Dialog.__init__(self, parent) 19 | 20 | # Create the components. 21 | interior = self.interior() 22 | 23 | # Create the counter. 24 | aliases = ( 25 | ('entryfield', 'counter_entryfield'), 26 | ('entry', 'counter_entryfield_entry'), 27 | ('label', 'counter_label') 28 | ) 29 | self._cdCounter = self.createcomponent('counter', 30 | aliases, None, 31 | Pmw.Counter, (interior,)) 32 | self._cdCounter.pack(fill='x', expand=1, 33 | padx = self['borderx'], pady = self['bordery']) 34 | 35 | if 'activatecommand' not in kw: 36 | # Whenever this dialog is activated, set the focus to the 37 | # Counter's entry widget. 38 | tkentry = self.component('entry') 39 | self.configure(activatecommand = tkentry.focus_set) 40 | 41 | # Check keywords and initialise options. 42 | self.initialiseoptions() 43 | 44 | # Supply aliases to some of the entry component methods. 45 | def insertentry(self, index, text): 46 | self._cdCounter.insert(index, text) 47 | 48 | def deleteentry(self, first, last=None): 49 | self._cdCounter.delete(first, last) 50 | 51 | def indexentry(self, index): 52 | return self._cdCounter.index(index) 53 | 54 | Pmw.forwardmethods(CounterDialog, Pmw.Counter, '_cdCounter') 55 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwLabeledWidget.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Pmw 3 | 4 | class LabeledWidget(Pmw.MegaWidget): 5 | def __init__(self, parent = None, **kw): 6 | 7 | # Define the megawidget options. 8 | INITOPT = Pmw.INITOPT 9 | optiondefs = ( 10 | ('labelmargin', 0, INITOPT), 11 | ('labelpos', None, INITOPT), 12 | ('sticky', 'nsew', INITOPT), 13 | ) 14 | self.defineoptions(kw, optiondefs) 15 | 16 | # Initialise the base class (after defining the options). 17 | Pmw.MegaWidget.__init__(self, parent) 18 | 19 | # Create the components. 20 | interior = Pmw.MegaWidget.interior(self) 21 | self._labelChildSite = self.createcomponent('labelchildsite', 22 | (), None, 23 | tkinter.Frame, (interior,)) 24 | self._labelChildSite.grid(column=2, row=2, sticky=self['sticky']) 25 | interior.grid_columnconfigure(2, weight=1) 26 | interior.grid_rowconfigure(2, weight=1) 27 | 28 | self.createlabel(interior) 29 | 30 | # Check keywords and initialise options. 31 | self.initialiseoptions() 32 | 33 | def interior(self): 34 | return self._labelChildSite 35 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwMessageDialog.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/messagedialog.itk code. 2 | 3 | import tkinter 4 | import Pmw 5 | 6 | class MessageDialog(Pmw.Dialog): 7 | def __init__(self, parent = None, **kw): 8 | 9 | # Define the megawidget options. 10 | INITOPT = Pmw.INITOPT 11 | optiondefs = ( 12 | ('borderx', 20, INITOPT), 13 | ('bordery', 20, INITOPT), 14 | ('iconmargin', 20, INITOPT), 15 | ('iconpos', None, INITOPT), 16 | ) 17 | self.defineoptions(kw, optiondefs) 18 | 19 | # Initialise the base class (after defining the options). 20 | Pmw.Dialog.__init__(self, parent) 21 | 22 | # Create the components. 23 | interior = self.interior() 24 | 25 | self._message = self.createcomponent('message', 26 | (), None, 27 | tkinter.Label, (interior,)) 28 | 29 | iconpos = self['iconpos'] 30 | iconmargin = self['iconmargin'] 31 | borderx = self['borderx'] 32 | bordery = self['bordery'] 33 | border_right = 2 34 | border_bottom = 2 35 | if iconpos is None: 36 | self._message.grid(column = 1, row = 1) 37 | else: 38 | self._icon = self.createcomponent('icon', 39 | (), None, 40 | tkinter.Label, (interior,)) 41 | if iconpos not in 'nsew': 42 | raise ValueError('bad iconpos option "%s": should be n, s, e, or w' \ 43 | % iconpos) 44 | 45 | if iconpos in 'nw': 46 | icon = 1 47 | message = 3 48 | else: 49 | icon = 3 50 | message = 1 51 | 52 | if iconpos in 'ns': 53 | # vertical layout 54 | self._icon.grid(column = 1, row = icon) 55 | self._message.grid(column = 1, row = message) 56 | interior.grid_rowconfigure(2, minsize = iconmargin) 57 | border_bottom = 4 58 | else: 59 | # horizontal layout 60 | self._icon.grid(column = icon, row = 1) 61 | self._message.grid(column = message, row = 1) 62 | interior.grid_columnconfigure(2, minsize = iconmargin) 63 | border_right = 4 64 | 65 | interior.grid_columnconfigure(0, minsize = borderx) 66 | interior.grid_rowconfigure(0, minsize = bordery) 67 | interior.grid_columnconfigure(border_right, minsize = borderx) 68 | interior.grid_rowconfigure(border_bottom, minsize = bordery) 69 | 70 | 71 | # Check keywords and initialise options. 72 | self.initialiseoptions() 73 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwPromptDialog.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/promptdialog.itk code. 2 | 3 | import Pmw 4 | 5 | # A Dialog with an entryfield 6 | 7 | class PromptDialog(Pmw.Dialog): 8 | def __init__(self, parent = None, **kw): 9 | # Define the megawidget options. 10 | INITOPT = Pmw.INITOPT 11 | optiondefs = ( 12 | ('borderx', 20, INITOPT), 13 | ('bordery', 20, INITOPT), 14 | ) 15 | self.defineoptions(kw, optiondefs) 16 | 17 | # Initialise the base class (after defining the options). 18 | Pmw.Dialog.__init__(self, parent) 19 | 20 | # Create the components. 21 | interior = self.interior() 22 | aliases = ( 23 | ('entry', 'entryfield_entry'), 24 | ('label', 'entryfield_label'), 25 | ) 26 | self._promptDialogEntry = self.createcomponent('entryfield', 27 | aliases, None, 28 | Pmw.EntryField, (interior,)) 29 | self._promptDialogEntry.pack(fill='x', expand=1, 30 | padx = self['borderx'], pady = self['bordery']) 31 | 32 | if 'activatecommand' not in kw: 33 | # Whenever this dialog is activated, set the focus to the 34 | # EntryField's entry widget. 35 | tkentry = self.component('entry') 36 | self.configure(activatecommand = tkentry.focus_set) 37 | 38 | # Check keywords and initialise options. 39 | self.initialiseoptions() 40 | 41 | # Supply aliases to some of the entry component methods. 42 | def insertentry(self, index, text): 43 | self._promptDialogEntry.insert(index, text) 44 | 45 | def deleteentry(self, first, last=None): 46 | self._promptDialogEntry.delete(first, last) 47 | 48 | def indexentry(self, index): 49 | return self._promptDialogEntry.index(index) 50 | 51 | Pmw.forwardmethods(PromptDialog, Pmw.EntryField, '_promptDialogEntry') 52 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwScrolledField.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Pmw 3 | 4 | class ScrolledField(Pmw.MegaWidget): 5 | def __init__(self, parent = None, **kw): 6 | 7 | # Define the megawidget options. 8 | INITOPT = Pmw.INITOPT 9 | optiondefs = ( 10 | ('labelmargin', 0, INITOPT), 11 | ('labelpos', None, INITOPT), 12 | ('sticky', 'ew', INITOPT), 13 | ('text', '', self._text), 14 | ) 15 | self.defineoptions(kw, optiondefs) 16 | 17 | # Initialise the base class (after defining the options). 18 | Pmw.MegaWidget.__init__(self, parent) 19 | 20 | # Create the components. 21 | interior = self.interior() 22 | self._scrolledFieldEntry = self.createcomponent('entry', 23 | (), None, 24 | tkinter.Entry, (interior,)) 25 | 26 | # Can't always use 'disabled', since this greys out text in Tk 8.4.2 27 | try: 28 | self._scrolledFieldEntry.configure(state = 'readonly') 29 | except tkinter.TclError: 30 | self._scrolledFieldEntry.configure(state = 'disabled') 31 | 32 | self._scrolledFieldEntry.grid(column=2, row=2, sticky=self['sticky']) 33 | interior.grid_columnconfigure(2, weight=1) 34 | interior.grid_rowconfigure(2, weight=1) 35 | 36 | self.createlabel(interior) 37 | 38 | # Check keywords and initialise options. 39 | self.initialiseoptions() 40 | 41 | def _text(self): 42 | text = self['text'] 43 | self._scrolledFieldEntry.configure(state = 'normal') 44 | self._scrolledFieldEntry.delete(0, 'end') 45 | self._scrolledFieldEntry.insert('end', text) 46 | 47 | # Can't always use 'disabled', since this greys out text in Tk 8.4.2 48 | try: 49 | self._scrolledFieldEntry.configure(state = 'readonly') 50 | except tkinter.TclError: 51 | self._scrolledFieldEntry.configure(state = 'disabled') 52 | 53 | Pmw.forwardmethods(ScrolledField, tkinter.Entry, '_scrolledFieldEntry') 54 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwSelectionDialog.py: -------------------------------------------------------------------------------- 1 | # Not Based on iwidgets version. 2 | 3 | import Pmw 4 | 5 | class SelectionDialog(Pmw.Dialog): 6 | # Dialog window with selection list. 7 | 8 | # Dialog window displaying a list and requesting the user to 9 | # select one. 10 | 11 | def __init__(self, parent = None, **kw): 12 | # Define the megawidget options. 13 | INITOPT = Pmw.INITOPT 14 | optiondefs = ( 15 | ('borderx', 10, INITOPT), 16 | ('bordery', 10, INITOPT), 17 | ) 18 | self.defineoptions(kw, optiondefs) 19 | 20 | # Initialise the base class (after defining the options). 21 | Pmw.Dialog.__init__(self, parent) 22 | 23 | # Create the components. 24 | interior = self.interior() 25 | aliases = ( 26 | ('listbox', 'scrolledlist_listbox'), 27 | ('label', 'scrolledlist_label'), 28 | ) 29 | self._list = self.createcomponent('scrolledlist', 30 | aliases, None, 31 | Pmw.ScrolledListBox, (interior,), 32 | dblclickcommand = self.invoke) 33 | self._list.pack(side='top', expand='true', fill='both', 34 | padx = self['borderx'], pady = self['bordery']) 35 | 36 | if 'activatecommand' not in kw: 37 | # Whenever this dialog is activated, set the focus to the 38 | # ScrolledListBox's listbox widget. 39 | listbox = self.component('listbox') 40 | self.configure(activatecommand = listbox.focus_set) 41 | 42 | # Check keywords and initialise options. 43 | self.initialiseoptions() 44 | 45 | # Need to explicitly forward this to override the stupid 46 | # (grid_)size method inherited from Tkinter.Toplevel.Grid. 47 | def size(self): 48 | return self.component('listbox').size() 49 | 50 | # Need to explicitly forward this to override the stupid 51 | # (grid_)bbox method inherited from Tkinter.Toplevel.Grid. 52 | def bbox(self, index): 53 | return self.component('listbox').size(index) 54 | 55 | Pmw.forwardmethods(SelectionDialog, Pmw.ScrolledListBox, '_list') 56 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/PmwTextDialog.py: -------------------------------------------------------------------------------- 1 | # A Dialog with a ScrolledText widget. 2 | 3 | import Pmw 4 | 5 | class TextDialog(Pmw.Dialog): 6 | def __init__(self, parent = None, **kw): 7 | # Define the megawidget options. 8 | INITOPT = Pmw.INITOPT 9 | optiondefs = ( 10 | ('borderx', 10, INITOPT), 11 | ('bordery', 10, INITOPT), 12 | ) 13 | self.defineoptions(kw, optiondefs) 14 | 15 | # Initialise the base class (after defining the options). 16 | Pmw.Dialog.__init__(self, parent) 17 | 18 | # Create the components. 19 | interior = self.interior() 20 | aliases = ( 21 | ('text', 'scrolledtext_text'), 22 | ('label', 'scrolledtext_label'), 23 | ) 24 | self._text = self.createcomponent('scrolledtext', 25 | aliases, None, 26 | Pmw.ScrolledText, (interior,)) 27 | self._text.pack(side='top', expand=1, fill='both', 28 | padx = self['borderx'], pady = self['bordery']) 29 | 30 | # Check keywords and initialise options. 31 | self.initialiseoptions() 32 | 33 | # Need to explicitly forward this to override the stupid 34 | # (grid_)bbox method inherited from Tkinter.Toplevel.Grid. 35 | def bbox(self, index): 36 | return self._text.bbox(index) 37 | 38 | Pmw.forwardmethods(TextDialog, Pmw.ScrolledText, '_text') 39 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # File to allow this directory to be treated as a python package. 2 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/AboutDialog_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/messagedialog.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | Pmw.aboutversion('2.0') 10 | Pmw.aboutcopyright('Copyright Really Good Software') 11 | Pmw.aboutcontact('For information about this application contact\nyour' + 12 | 'system administrator') 13 | 14 | c = Pmw.AboutDialog 15 | 16 | kw_1 = { 17 | 'applicationname' : 'Really Good Application', 18 | 'buttonbox_padx': 30, 19 | } 20 | tests_1 = ( 21 | (Test.num_options, (), 14), 22 | ('message_anchor', 'center'), 23 | ('message_justify', 'center'), 24 | ('message_wraplength', 0), 25 | ('hull_background', '#d9d9d9'), 26 | ('icon_bitmap', 'warning'), 27 | ('hull_cursor', 'gumby'), 28 | ('icon_image', Test.flagup), 29 | ('message_font', Test.font['variable']), 30 | ('message_foreground', 'red'), 31 | ('message_padx', 15), 32 | ('message_pady', 15), 33 | ('icon_image', ''), 34 | (c.title, 'AboutDialog 1: new title', ''), 35 | (c.interior, (), tkinter.Frame), 36 | (Pmw.aboutcontact, ''), 37 | ) 38 | 39 | kw_2 = { 40 | 'applicationname' : 'Another Really Good Application', 41 | 'buttonboxpos': 'e', 42 | 'iconpos': 'n', 43 | 'borderx': 15, 44 | 'bordery': 15, 45 | 'separatorwidth': 5, 46 | } 47 | tests_2 = ( 48 | (c.title, 'AboutDialog 2', ''), 49 | ) 50 | 51 | alltests = ( 52 | (tests_1, kw_1), 53 | (tests_2, kw_2), 54 | ) 55 | 56 | testData = ((c, alltests),) 57 | if __name__ == '__main__': 58 | Test.runTests(testData) 59 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/All.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import re 5 | import sys 6 | import tkinter 7 | 8 | import Test 9 | Test.initialise() 10 | 11 | # Uncomment these to modify period between tests and how much output 12 | # to print: 13 | #Test.setdelay(1000) 14 | #Test.setverbose(1) 15 | 16 | # Ignore Tkinter test since it does not test any Pmw functionality 17 | # (only Tkinter) and it fails under MS-Windows 95 (and it hasn't been 18 | # kept up-to-date with changes to Tk. 19 | ignoreTests = ('Tkinter_test.py',) 20 | 21 | # Also ignore Blt test since it causes Blt 2.4z to core dump. 22 | if tkinter.TkVersion >= 8.4: 23 | ignoreTests = ignoreTests + ('Blt_test.py',) 24 | 25 | allTestData = () 26 | files = os.listdir(os.curdir) 27 | files.sort() 28 | 29 | for file in files: 30 | if file not in ignoreTests and re.search('^.+_test.py$', file) is not None: 31 | test = file[:-3] 32 | exec('import ' + test) 33 | exec('allTestData = allTestData + ' + test + '.testData') 34 | Test.runTests(allTestData) 35 | 36 | print('All tests executed') -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/ButtonBox_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/buttonbox.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | c = Pmw.ButtonBox 10 | 11 | kw_1 = {} 12 | tests_1 = ( 13 | (c.pack, ()), 14 | (c.add, 'Yes', tkinter.Button), 15 | (c.add, 'No', tkinter.Button), 16 | (c.setdefault, 'Yes'), 17 | (c.alignbuttons, ()), 18 | (Test.num_options, (), 5), 19 | # button_ options do not exist - there is no 'button' component 20 | # can not test on added buttons since the framework creates new objects 21 | # for testing purposes 22 | ('Button_activebackground', '#ececec'), 23 | ('Button_activeforeground', 'Black'), 24 | ('hull_background', '#d9d9d9'), 25 | ('hull_cursor', 'gumby'), 26 | ('Button_background', 'aliceblue'), 27 | ('Button_disabledforeground', '#a3a3a3'), 28 | ('Button_foreground', 'Black'), 29 | ('Button_highlightcolor', 'Black'), 30 | ('Button_highlightthickness', 2), 31 | (c.index, 0, 0), 32 | (c.index, Pmw.END, 1), 33 | (c.index, Pmw.DEFAULT, 0), 34 | (c.index, 'No', 1), 35 | (c.index, 'Yes', 0), 36 | (c.add, 'Maybe', tkinter.Button), 37 | (c.insert, ('Never', 0), {'text' : 'Never Never'}, tkinter.Button), 38 | (c.setdefault, 'Never'), 39 | (c.invoke, 'Yes', ''), 40 | (c.invoke, (), ''), 41 | (c.invoke, Pmw.DEFAULT, ''), 42 | (c.delete, 'Maybe'), 43 | ('Yes_text', 'YES'), 44 | (c.index, 12, 'ValueError: index "12" is out of range'), 45 | (c.index, 'bogus', 'ValueError: bad index "bogus": ' + \ 46 | 'must be a name, a number, Pmw.END or Pmw.DEFAULT'), 47 | ) 48 | 49 | kw_2 = { 50 | 'orient' : 'vertical', 51 | 'padx' : 30, 52 | 'pady' : 30, 53 | 'labelpos' : 'w', 54 | 'label_text' : 'Vertical\nButtonBox', 55 | } 56 | tests_2 = ( 57 | (c.pack, ()), 58 | (c.add, 'Hello', tkinter.Button), 59 | (c.insert, ('GoodBye', Pmw.END), tkinter.Button), 60 | (c.setdefault, 'Hello'), 61 | (c.setdefault, 'GoodBye'), 62 | (c.setdefault, None), 63 | (c.index, Pmw.DEFAULT, 'ValueError: ButtonBox has no default'), 64 | ) 65 | 66 | alltests = ( 67 | (tests_1, kw_1), 68 | (tests_2, kw_2), 69 | ) 70 | 71 | testData = ((c, alltests),) 72 | 73 | if __name__ == '__main__': 74 | Test.runTests(testData) 75 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/Colors_test.py: -------------------------------------------------------------------------------- 1 | # Tests for Pmw color handling. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | testData = () 9 | 10 | defaultPalette = Pmw.Color.getdefaultpalette(Test.root) 11 | 12 | c = tkinter.Button 13 | 14 | colors = ('red', 'orange', 'yellow', 'green', 'blue', 'purple', 'white') 15 | normalcolors = list(map(Pmw.Color.changebrightness, 16 | (Test.root,) * len(colors), colors, (0.85,) * len(colors))) 17 | 18 | kw = {} 19 | tests = ( 20 | (Pmw.Color.setscheme, (Test.root, normalcolors[0]), {'foreground' : 'white'}), 21 | ) 22 | testData = testData + ((c, ((tests, kw),)),) 23 | 24 | for color in normalcolors[1:]: 25 | kw = {'text' : color} 26 | tests = ( 27 | (c.pack, ()), 28 | ('state', 'active'), 29 | ) 30 | testData = testData + ((c, ((tests, kw),)),) 31 | 32 | kw = {} 33 | tests = ( 34 | (Pmw.Color.setscheme, (Test.root, color), {'foreground' : 'red'}), 35 | ) 36 | testData = testData + ((c, ((tests, kw),)),) 37 | 38 | # Restore the default colors. 39 | kw = {} 40 | tests = ( 41 | (Pmw.Color.setscheme, (Test.root,), defaultPalette), 42 | ) 43 | testData = testData + ((c, ((tests, kw),)),) 44 | 45 | if __name__ == '__main__': 46 | Test.runTests(testData) 47 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/CounterDialog_test.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Test 3 | import Pmw 4 | 5 | Test.initialise() 6 | 7 | c = Pmw.CounterDialog 8 | 9 | kw_1 = { 10 | 'counter_labelpos': 'n', 11 | 'counter_buttonaspect': 2.0, 12 | 'counter_autorepeat': 0, 13 | 'counter_initwait': 1000, 14 | 'counter_padx': 5, 15 | 'counter_pady': 5, 16 | 'counter_repeatrate': 20, 17 | 'label_text' : 'Counter:', 18 | 'buttons' : ('OK', 'Cancel', 'Help'), 19 | } 20 | tests_1 = ( 21 | (Test.num_options, (), 11), 22 | ('counter_Arrow_borderwidth', 10), 23 | ('counter_hull_background', 'yellow'), 24 | ('command', Test.callback1), 25 | ('hull_cursor', 'gumby'), 26 | ('counter_datatype', 'time'), 27 | ('counter_datatype', 'numeric'), 28 | ('entry_borderwidth', 6), 29 | ('entry_relief', 'raised'), 30 | ('entry_exportselection', 0), 31 | ('entry_foreground', 'blue'), 32 | ('hull_highlightcolor', 'Red'), 33 | ('hull_highlightthickness', 2), 34 | ('counter_increment', 1), 35 | ('entry_insertbackground', 'Yellow'), 36 | ('entry_insertbackground', 'Black'), 37 | ('entry_insertborderwidth', 1), 38 | ('entry_insertborderwidth', 0), 39 | ('entry_insertofftime', 400), 40 | ('entry_insertontime', 700), 41 | ('entry_insertwidth', 3), 42 | ('entryfield_invalidcommand', Test.callback), 43 | ('entry_show', '*'), 44 | ('entry_background', 'red'), 45 | (c.setentry, '69', 1), 46 | ('entry_justify', 'right'), 47 | ('entry_justify', 'center'), 48 | ('entry_justify', 'left'), 49 | ('label_text', 'Label'), 50 | ('entry_relief', 'raised'), 51 | ('entry_relief', 'sunken'), 52 | ('entry_state', 'disabled'), 53 | ('entry_state', 'normal'), 54 | ('entry_background', 'GhostWhite'), 55 | ('entryfield_validate', 'numeric'), 56 | ('entryfield_validate', 'alphabetic'), 57 | ('entry_width', 30), 58 | ('relief', 'bogus', 'KeyError: Unknown option "relief" for CounterDialog'), 59 | (c.interior, (), tkinter.Frame), 60 | (c.insert, ('end', 69)), 61 | (c.increment, ()), 62 | (c.decrement, ()), 63 | ('defaultbutton', 1), 64 | (c.invoke, (), 'Cancel'), 65 | (c.clear, ()), 66 | (c.get, (), ''), 67 | (c.insert, ('end', 'Test String')), 68 | (c.get, (), 'Test String'), 69 | (c.delete, (0, 'end')), 70 | (c.insert, ('end', 'Another Test')), 71 | (c.icursor, 'end'), 72 | (c.index, 'end', 12), 73 | (c.selection_from, 0), 74 | (c.selection_to, 'end'), 75 | (c.xview, '3'), 76 | (c.clear, ()), 77 | ) 78 | 79 | kw_2 = { 80 | 'buttonboxpos': 'e', 81 | 'counter_labelpos': 'w', 82 | 'label_text' : 'Another counter', 83 | 'buttonbox_pady': 25, 84 | 'buttons' : ('OK', 'Cancel'), 85 | } 86 | tests_2 = ( 87 | (c.title, 'CounterDialog 2', ''), 88 | ) 89 | 90 | alltests = ( 91 | (tests_1, kw_1), 92 | (tests_2, kw_2), 93 | ) 94 | 95 | testData = ((c, alltests),) 96 | 97 | if __name__ == '__main__': 98 | Test.runTests(testData) 99 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/EntryField_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/entryfield.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | _myValidators = { 10 | 'hello' : (lambda s: s == 'hello', len), 11 | } 12 | 13 | c = Pmw.EntryField 14 | 15 | kw_1 = {'entry_width' : 12, 'labelpos' : 'n', 'label_text' : 'Entry Field:'} 16 | tests_1 = ( 17 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 18 | (Test.num_options, (), 10), 19 | ('errorbackground', 'red'), 20 | ('hull_background', 'yellow'), 21 | ('label_background', 'yellow'), 22 | ('entry_background', 'yellow'), 23 | ('hull_show', 'X', 'TclError: unknown option "-show"'), 24 | ('entry_show', ''), 25 | ('entry_borderwidth', 4), 26 | ('entry_borderwidth', 2), 27 | ('command', Test.callback), 28 | ('hull_cursor', 'gumby'), 29 | ('entry_exportselection', 0), 30 | ('label_foreground', 'Green'), 31 | ('entry_foreground', 'Green'), 32 | ('label_foreground', 'Black'), 33 | ('entry_foreground', 'Black'), 34 | ('label_highlightcolor', 'Red'), 35 | ('entry_highlightcolor', 'Red'), 36 | ('entry_highlightthickness', 2), 37 | ('entry_insertbackground', 'Yellow'), 38 | ('entry_insertbackground', 'Black'), 39 | ('entry_insertborderwidth', 1), 40 | ('entry_insertborderwidth', 0), 41 | ('entry_insertofftime', 400), 42 | ('entry_insertontime', 700), 43 | ('entry_insertwidth', 3), 44 | ('invalidcommand', Test.callback), 45 | ('entry_justify', 'right'), 46 | ('entry_justify', 'center'), 47 | ('entry_justify', 'left'), 48 | ('label_text', 'Label'), 49 | ('entry_relief', 'raised'), 50 | ('entry_relief', 'sunken'), 51 | ('entry_state', 'disabled'), 52 | ('entry_state', 'normal'), 53 | ('entry_background', 'GhostWhite'), 54 | ('validate', 'numeric'), 55 | ('validate', 'alphabetic'), 56 | ('entry_width', 30), 57 | ('validate', 'bogus', 58 | "ValueError: bad validate value \"bogus\": must be a function or one " + 59 | "of the standard validators ('alphabetic', 'alphanumeric', 'date', " + 60 | "'hexadecimal', 'integer', 'numeric', 'real', 'time') or extra " + 61 | "validators ()"), 62 | ('relief', 'bogus', 'KeyError: Unknown option "relief" for EntryField'), 63 | (c.invoke, (), 1), 64 | (c.interior, (), tkinter.Frame), 65 | (c.clear, ()), 66 | (c.get, (), ''), 67 | (c.insert, ('end', 'Test String')), 68 | (c.get, (), 'Test String'), 69 | (c.delete, (0, 'end')), 70 | (c.insert, ('end', 'Another Test')), 71 | (c.icursor, 'end'), 72 | (c.index, 'end', 12), 73 | (c.selection_from, 0), 74 | (c.selection_to, 'end'), 75 | (c.xview, '3'), 76 | (c.clear, ()), 77 | (c.insert, ('end', '100')), 78 | ('validate', {'validator' : 'real', 'min' : 10}), 79 | (c.setentry, '50', 1), 80 | (c.setentry, 'hello', 0), 81 | ('extravalidators', _myValidators), 82 | ('validate', 'hello'), 83 | (c.setentry, 'hello', 1), 84 | (c.setentry, 'foo', 0), 85 | (c.valid, (), 1), 86 | (c.cget, 'entry_background', 'GhostWhite'), 87 | ('entry_textvariable', Test.stringvar), 88 | (c.checkentry, (), 0), 89 | (c.cget, 'entry_background', 'red'), 90 | ) 91 | 92 | tests_2 = ( 93 | (c.pack, (), {'padx' : 10, 'pady' : 10}), 94 | ) 95 | 96 | alltests = [(tests_1, kw_1)] 97 | 98 | poslist = ('nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn',) 99 | for pos in poslist: 100 | kw_2 = { 101 | 'labelpos' : pos, 102 | 'label_text' : 'Entry Field', 103 | } 104 | alltests.append((tests_2, kw_2)) 105 | 106 | testData = ((c, alltests),) 107 | 108 | if __name__ == '__main__': 109 | Test.runTests(testData) 110 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/LabeledWidget_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/labeledwidget.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | c = Pmw.LabeledWidget 10 | 11 | def _addListbox(): 12 | w = Test.currentWidget() 13 | lb = tkinter.Listbox(w.interior(), relief = 'sunken') 14 | lb.pack(padx = 10, pady = 10) 15 | 16 | def _testalignLabels(): 17 | w = Test.currentWidget() 18 | return Pmw.alignlabels((w,)) 19 | 20 | kw_1 = {'labelpos': 'nw'} 21 | tests_1 = ( 22 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 23 | (_addListbox, ()), 24 | (Test.num_options, (), 3), 25 | ('label_textvariable', Test.stringvar), 26 | ('label_textvariable', ''), 27 | ('label_text', 'Label'), 28 | ('label_font', Test.font['small']), 29 | ('label_image', Test.flagup), 30 | ('label_image', ''), 31 | (c.interior, (), tkinter.Frame), 32 | (_testalignLabels, (), None), 33 | ) 34 | 35 | kw_2 = {'label_text' : 'ListBox', 'labelpos' : 's'} 36 | tests_2 = ( 37 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 38 | (_addListbox, ()), 39 | ) 40 | 41 | alltests = ( 42 | (tests_1, kw_1), 43 | (tests_2, kw_2), 44 | ) 45 | 46 | testData = ((c, alltests),) 47 | 48 | if __name__ == '__main__': 49 | Test.runTests(testData) 50 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/MessageDialog_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/messagedialog.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | c = Pmw.MessageDialog 10 | 11 | kw_1 = { 12 | 'message_text' : 'Are you sure you want to do that?', 13 | 'buttons' : ('OK', 'Cancel'), 14 | 'icon_bitmap' : 'questhead', 15 | 'iconmargin': '60', 16 | 'iconpos' : 'w', 17 | 'buttonbox_padx': 30, 18 | } 19 | tests_1 = ( 20 | (Test.num_options, (), 13), 21 | ('message_anchor', 'center'), 22 | ('message_justify', 'center'), 23 | ('message_wraplength', 0), 24 | ('hull_background', '#d9d9d9'), 25 | ('icon_bitmap', 'warning'), 26 | ('hull_cursor', 'gumby'), 27 | ('icon_image', Test.flagup), 28 | ('message_font', Test.font['variable']), 29 | ('message_foreground', 'red'), 30 | ('message_padx', 15), 31 | ('message_pady', 15), 32 | ('icon_image', ''), 33 | (c.title, 'MessageDialog 1: new title', ''), 34 | (c.interior, (), tkinter.Frame), 35 | ('defaultbutton', 'OK'), 36 | ) 37 | 38 | kw_2 = { 39 | 'message_text' : 'On the left', 40 | 'buttons' : ('OK', 'Cancel'), 41 | 'buttonboxpos': 'e', 42 | 'borderx': 55, 43 | 'bordery': 55, 44 | 'separatorwidth': 5, 45 | } 46 | tests_2 = ( 47 | (c.title, 'MessageDialog 2', ''), 48 | ) 49 | 50 | alltests = ( 51 | (tests_1, kw_1), 52 | (tests_2, kw_2), 53 | ) 54 | 55 | testData = ((c, alltests),) 56 | 57 | if __name__ == '__main__': 58 | Test.runTests(testData) 59 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/OptionMenu_test.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Test 3 | import Pmw 4 | 5 | Test.initialise() 6 | 7 | c = Pmw.OptionMenu 8 | 9 | kw_1 = { 10 | 'labelpos' : 'nw', 11 | 'label_text' : 'Option Menu:', 12 | 'items' : ('Chips', 'Lollies', 'Junk', 'More junk'), 13 | 'initialitem' : 1, 14 | } 15 | tests_1 = ( 16 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 17 | (Test.num_options, (), 6), 18 | (c.getcurselection, (), 'Lollies'), 19 | (c.index, 'Junk', 2), 20 | (c.index, 'Nowhere', 'ValueError: bad index "Nowhere": must be ' + 21 | 'a name, a number, Pmw.END or Pmw.SELECT'), 22 | (c.index, Pmw.END, 3), 23 | (c.index, Pmw.SELECT, 1), 24 | (c.index, 1, 1), 25 | (c.invoke, 'Chips'), 26 | (c.getcurselection, (), 'Chips'), 27 | ('command', Test.callback1), 28 | (c.invoke, (), 'Chips'), 29 | (c.invoke, 'Lollies', 'Lollies'), 30 | (c.getcurselection, (), 'Lollies'), 31 | ('hull_background', 'yellow'), 32 | ('hull_show', 'X', 'TclError: unknown option "-show"'), 33 | (c.index, Pmw.SELECT, 1), 34 | (c.setitems, (('Chips', 'Junk', 'Lollies', 'More junk'),)), 35 | (c.index, Pmw.SELECT, 2), 36 | (c.setitems, (('Fruit', 'Vegetables', 'Cereals', 'Legumes'),)), 37 | (c.index, Pmw.SELECT, 0), 38 | (c.getcurselection, (), 'Fruit'), 39 | (c.setitems, (('Vegetables', 'Cereals', 'Legumes'), Pmw.END)), 40 | (c.getcurselection, (), 'Legumes'), 41 | (c.index, 'Vegetables', 0), 42 | (c.invoke, 'Legumes', 'Legumes'), 43 | ('hull_cursor', 'gumby'), 44 | ('label_foreground', 'Green'), 45 | ('label_foreground', 'Black'), 46 | ('label_highlightcolor', 'Red'), 47 | ('label_text', 'Label'), 48 | ) 49 | 50 | testData = ((c, ((tests_1, kw_1),)),) 51 | 52 | if __name__ == '__main__': 53 | Test.runTests(testData) 54 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/PanedWidget_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tkinter 3 | import Test 4 | import Pmw 5 | 6 | Test.initialise() 7 | 8 | c = Pmw.PanedWidget 9 | 10 | def _setbackground(name, colour): 11 | w = Test.currentWidget() 12 | w.pane(name).configure(background = colour) 13 | 14 | kw_1 = {'orient': 'horizontal', 'hull_width': 400, 'hull_height': 300} 15 | tests_1 = ( 16 | (c.pack, ()), 17 | (Test.num_options, (), 5), 18 | (c.add, 'left', {'min' : 100}, tkinter.Frame), 19 | (_setbackground, ('left', 'red')), 20 | (c.add, 'middle', {'max' : 100}, tkinter.Frame), 21 | (_setbackground, ('middle', 'green')), 22 | (c.add, 'right', {'size' : 100}, tkinter.Frame), 23 | (c.insert, ('first', 'middle'), {'size' : 100}, tkinter.Frame), 24 | (_setbackground, ('right', 'yellow')), 25 | (_setbackground, ('first', 'blue')), 26 | (c.delete, 'middle'), 27 | (c.pane, 'left', tkinter.Frame), 28 | (c.panes, (), ['left', 'first', 'right']), 29 | (c.configurepane, 'first', {'size' : 200}), 30 | ) 31 | 32 | alltests = ( 33 | (tests_1, kw_1), 34 | ) 35 | 36 | testData = ((c, alltests),) 37 | 38 | if __name__ == '__main__': 39 | Test.runTests(testData) 40 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/PromptDialog_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/promptdialog.test code. 2 | 3 | import tkinter 4 | import Test 5 | import Pmw 6 | 7 | Test.initialise() 8 | 9 | c = Pmw.PromptDialog 10 | 11 | kw_1 = { 12 | 'entryfield_labelpos': 'n', 13 | 'label_text' : 'Please enter your password', 14 | 'buttons' : ('OK', 'Cancel', 'Help'), 15 | } 16 | tests_1 = ( 17 | (Test.num_options, (), 11), 18 | (c.title, 'PromptDialog 1', ''), 19 | ('hull_background', '#d9d9d9'), 20 | ('hull_cursor', 'gumby'), 21 | ('entry_exportselection', 1), 22 | ('entry_foreground', 'Black'), 23 | ('entry_background', 'GhostWhite'), 24 | ('entry_insertbackground', 'Black'), 25 | ('entry_insertborderwidth', 1), 26 | ('entry_insertborderwidth', 0), 27 | ('entry_insertofftime', 400), 28 | ('entry_insertontime', 700), 29 | ('entry_insertwidth', 3), 30 | ('label_text', 'Label'), 31 | ('entry_justify', 'left'), 32 | ('entry_relief', 'sunken'), 33 | ('entry_state', 'disabled'), 34 | ('entry_state', 'normal'), 35 | ('entry_background', 'GhostWhite'), 36 | ('entryfield_validate', 'numeric'), 37 | ('entryfield_validate', 'alphabetic'), 38 | ('entryfield_validate', 'alphanumeric'), 39 | ('entry_width', 30), 40 | (c.interior, (), tkinter.Frame), 41 | (c.insertentry, ('end', 'Test String')), 42 | (c.get, (), 'Test String'), 43 | (c.deleteentry, (0, 'end')), 44 | (c.insertentry, ('end', 'Another Test')), 45 | (c.icursor, 'end'), 46 | (c.indexentry, 'end', 12), 47 | (c.selection_from, 0), 48 | (c.selection_to, 'end'), 49 | (c.xview, 3), 50 | (c.clear, ()), 51 | (c.get, (), ''), 52 | ('label_bitmap', 'warning'), 53 | ('label_image', Test.flagup), 54 | ('entry_font', Test.font['variable']), 55 | ('entry_foreground', 'red'), 56 | ('label_image', ''), 57 | ('label_bitmap', ''), 58 | (c.title, 'PromptDialog 1: new title', ''), 59 | ('defaultbutton', 'OK'), 60 | ) 61 | 62 | kw_2 = { 63 | 'buttonboxpos': 'e', 64 | 'entryfield_labelpos': 'w', 65 | 'label_text' : 'Please enter your password', 66 | 'buttonbox_pady': 25, 67 | 'buttons' : ('OK', 'Cancel'), 68 | } 69 | tests_2 = ( 70 | (c.title, 'PromptDialog 2', ''), 71 | ) 72 | 73 | alltests = ( 74 | (tests_1, kw_1), 75 | (tests_2, kw_2), 76 | ) 77 | 78 | testData = ((c, alltests),) 79 | 80 | if __name__ == '__main__': 81 | Test.runTests(testData) 82 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/ScrolledCanvas_test.py: -------------------------------------------------------------------------------- 1 | import Test 2 | import Pmw 3 | 4 | Test.initialise() 5 | 6 | c = Pmw.ScrolledCanvas 7 | 8 | def _createOvals(): 9 | w = Test.currentWidget() 10 | w.create_oval(50, 50, 150, 100, fill = 'red') 11 | w.create_oval(100, 50, 150, 150, fill = 'blue') 12 | w.create_oval(50, 100, 200, 350, fill = 'yellow') 13 | 14 | def _createWindow(): 15 | w = Test.currentWidget() 16 | lb = Pmw.ScrolledListBox(w.interior(), 17 | items = list(range(20)), listbox_height = 6) 18 | w.create_window(300, 100, window = lb) 19 | 20 | def _testYView(doBottom): 21 | w = Test.currentWidget() 22 | top, bottom = w.yview() 23 | if type(top) != type(0.0) or type(bottom) != type(0.0): 24 | return 'bad type ' + str(top) + ' ' + str(bottom) 25 | if doBottom: 26 | if bottom != 1.0: 27 | return 'bottom is ' + str(bottom) 28 | else: 29 | if top != 0.0: 30 | return 'top is ' + str(top) 31 | 32 | kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledCanvas', 'borderframe' : 1} 33 | tests_1 = ( 34 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 35 | (Test.num_options, (), 8), 36 | (_createOvals, ()), 37 | (c.resizescrollregion, ()), 38 | (_createWindow, ()), 39 | (c.resizescrollregion, ()), 40 | ('hull_background', 'aliceblue'), 41 | ('Scrollbar_borderwidth', 3), 42 | ('hull_cursor', 'gumby'), 43 | ('label_text', 'Label'), 44 | ('Scrollbar_repeatdelay', 200), 45 | ('Scrollbar_repeatinterval', 105), 46 | ('vscrollmode', 'none'), 47 | ('vscrollmode', 'static'), 48 | ('vscrollmode', 'dynamic'), 49 | ('hscrollmode', 'none'), 50 | ('hscrollmode', 'static'), 51 | ('hscrollmode', 'dynamic'), 52 | ('Scrollbar_width', 20), 53 | ('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' + 54 | 'option "bogus": should be static, dynamic, or none'), 55 | ('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' + 56 | 'option "bogus": should be static, dynamic, or none'), 57 | (c.yview, ('moveto', 0.0)), 58 | (_testYView, 0), 59 | (c.yview, ('moveto', 0.02)), 60 | (c.yview, ('moveto', 0.04)), 61 | (c.yview, ('moveto', 0.06)), 62 | (c.yview, ('moveto', 0.08)), 63 | (c.yview, ('moveto', 0.10)), 64 | (c.yview, ('moveto', 0.12)), 65 | (c.yview, ('moveto', 0.14)), 66 | (c.yview, ('moveto', 0.16)), 67 | (c.yview, ('moveto', 0.18)), 68 | (c.yview, ('moveto', 0.20)), 69 | (c.yview, ('moveto', 0.22)), 70 | (c.yview, ('moveto', 0.24)), 71 | (c.yview, ('moveto', 0.26)), 72 | (c.yview, ('moveto', 0.28)), 73 | (c.yview, ('moveto', 0.98)), 74 | (_testYView, 1), 75 | (c.yview, ('scroll', -1, 'page')), 76 | (c.yview, ('scroll', -1, 'page')), 77 | (_testYView, 0), 78 | (c.yview, ('scroll', 1, 'page')), 79 | (c.yview, ('scroll', 1, 'page')), 80 | (_testYView, 1), 81 | ) 82 | 83 | kw_2 = { 84 | 'hscrollmode' : 'dynamic', 85 | 'label_text' : 'Label', 86 | 'labelpos' : 'n', 87 | 'scrollmargin': 20, 88 | 'canvasmargin': 20, 89 | 'usehullsize': 1, 90 | 'hull_width' : 500, 91 | 'hull_height' : 200, 92 | } 93 | tests_2 = ( 94 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 95 | ) 96 | 97 | alltests = ( 98 | (tests_1, kw_1), 99 | (tests_2, kw_2), 100 | ) 101 | 102 | testData = ((Pmw.ScrolledCanvas, alltests),) 103 | 104 | if __name__ == '__main__': 105 | Test.runTests(testData) 106 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/ScrolledField_test.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Test 3 | import Pmw 4 | 5 | Test.initialise() 6 | 7 | c = Pmw.ScrolledField 8 | 9 | kw_1 = {'labelpos': 'nw'} 10 | tests_1 = ( 11 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 12 | (Test.num_options, (), 4), 13 | ('text', 'Hello World'), 14 | ('label_textvariable', Test.stringvar), 15 | ('label_textvariable', ''), 16 | ('label_text', 'Label'), 17 | ('label_font', Test.font['small']), 18 | ('label_image', Test.flagup), 19 | ('label_image', ''), 20 | ('entry_foreground', 'red'), 21 | ('text', 'Foo'), 22 | ('entry_font', Test.font['small']), 23 | ) 24 | 25 | alltests = ( 26 | (tests_1, kw_1), 27 | ) 28 | 29 | testData = ((c, alltests),) 30 | 31 | if __name__ == '__main__': 32 | Test.runTests(testData) 33 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/ScrolledFrame_test.py: -------------------------------------------------------------------------------- 1 | import Test 2 | import Pmw 3 | 4 | Test.initialise() 5 | 6 | c = Pmw.ScrolledFrame 7 | 8 | def _createInterior(): 9 | w = Test.currentWidget() 10 | for i in range(3): 11 | lb = Pmw.ScrolledListBox(w.interior(), 12 | items = list(range(20)), listbox_height = 6) 13 | lb.pack(padx = 10, pady = 10) 14 | 15 | def _testYView(doBottom): 16 | w = Test.currentWidget() 17 | top, bottom = w.yview() 18 | if type(top) != type(0.0) or type(bottom) != type(0.0): 19 | return 'bad type ' + str(top) + ' ' + str(bottom) 20 | if doBottom: 21 | if bottom != 1.0: 22 | return 'bottom is ' + str(bottom) 23 | else: 24 | if top != 0.0: 25 | return 'top is ' + str(top) 26 | 27 | kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledFrame'} 28 | tests_1 = ( 29 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 30 | (Test.num_options, (), 11), 31 | (_createInterior, ()), 32 | ('hull_background', 'aliceblue'), 33 | ('Scrollbar_borderwidth', 3), 34 | ('hull_cursor', 'gumby'), 35 | ('label_text', 'Label'), 36 | ('Scrollbar_repeatdelay', 200), 37 | ('Scrollbar_repeatinterval', 105), 38 | ('vscrollmode', 'none'), 39 | ('vscrollmode', 'static'), 40 | ('vscrollmode', 'dynamic'), 41 | ('hscrollmode', 'none'), 42 | ('hscrollmode', 'static'), 43 | ('hscrollmode', 'dynamic'), 44 | ('Scrollbar_width', 20), 45 | ('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' + 46 | 'option "bogus": should be static, dynamic, or none'), 47 | ('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' + 48 | 'option "bogus": should be static, dynamic, or none'), 49 | (c.cget, 'vscrollmode', 'bogus'), 50 | (c.cget, 'hscrollmode', 'bogus'), 51 | ('vscrollmode', 'dynamic'), 52 | ('hscrollmode', 'dynamic'), 53 | (_testYView, 0), 54 | (c.yview, ('moveto', 0.02)), 55 | (c.yview, ('moveto', 0.04)), 56 | (c.yview, ('moveto', 0.06)), 57 | (c.yview, ('moveto', 0.08)), 58 | (c.yview, ('moveto', 0.10)), 59 | (c.yview, ('moveto', 0.12)), 60 | (c.yview, ('moveto', 0.14)), 61 | (c.yview, ('moveto', 0.16)), 62 | (c.yview, ('moveto', 0.18)), 63 | (c.yview, ('moveto', 0.20)), 64 | (c.yview, ('moveto', 0.22)), 65 | (c.yview, ('moveto', 0.24)), 66 | (c.yview, ('moveto', 0.26)), 67 | (c.yview, ('moveto', 0.28)), 68 | (c.yview, ('moveto', 0.98)), 69 | (_testYView, 1), 70 | (c.yview, ('scroll', -1, 'page')), 71 | (c.yview, ('scroll', -1, 'page')), 72 | (c.yview, ('scroll', -1, 'page')), 73 | (_testYView, 0), 74 | (c.yview, ('scroll', 1, 'page')), 75 | (c.yview, ('scroll', 1, 'page')), 76 | (c.yview, ('scroll', 1, 'page')), 77 | (_testYView, 1), 78 | ) 79 | 80 | kw_2 = { 81 | 'hscrollmode' : 'dynamic', 82 | 'label_text' : 'Label', 83 | 'labelpos' : 'n', 84 | 'scrollmargin': 20, 85 | } 86 | tests_2 = ( 87 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 88 | ) 89 | 90 | alltests = ( 91 | (tests_1, kw_1), 92 | (tests_2, kw_2), 93 | ) 94 | 95 | testData = ((Pmw.ScrolledFrame, alltests),) 96 | 97 | if __name__ == '__main__': 98 | Test.runTests(testData) 99 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/ScrolledText_test.py: -------------------------------------------------------------------------------- 1 | # Based on iwidgets2.2.0/tests/scrolledtext.test code. 2 | 3 | import Test 4 | import Pmw 5 | 6 | Test.initialise() 7 | 8 | c = Pmw.ScrolledText 9 | 10 | def _testYView(doBottom): 11 | w = Test.currentWidget() 12 | top, bottom = w.yview() 13 | if type(top) != type(0.0) or type(bottom) != type(0.0): 14 | return 'bad type ' + str(top) + ' ' + str(bottom) 15 | if doBottom: 16 | if bottom != 1.0: 17 | return 'bottom is ' + str(bottom) 18 | else: 19 | if top != 0.0: 20 | return 'top is ' + str(top) 21 | 22 | kw_1 = {'labelpos': 'n', 'label_text': 'ScrolledText'} 23 | tests_1 = ( 24 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 25 | (Test.num_options, (), 10), 26 | (c.importfile, 'ScrolledText_test.py'), 27 | ('hull_background', 'aliceblue'), 28 | ('text_borderwidth', 3), 29 | ('Scrollbar_borderwidth', 3), 30 | ('hull_cursor', 'gumby'), 31 | ('text_exportselection', 0), 32 | ('text_exportselection', 1), 33 | ('text_foreground', 'Black'), 34 | ('text_height', 10), 35 | ('text_width', 20), 36 | ('text_insertbackground', 'Black'), 37 | ('text_insertborderwidth', 1), 38 | ('text_insertofftime', 200), 39 | ('text_insertontime', 500), 40 | ('text_insertwidth', 3), 41 | ('label_text', 'Label'), 42 | ('text_relief', 'raised'), 43 | ('text_relief', 'sunken'), 44 | ('Scrollbar_repeatdelay', 200), 45 | ('Scrollbar_repeatinterval', 105), 46 | ('vscrollmode', 'none'), 47 | ('vscrollmode', 'static'), 48 | ('vscrollmode', 'dynamic'), 49 | ('hscrollmode', 'none'), 50 | ('hscrollmode', 'static'), 51 | ('hscrollmode', 'dynamic'), 52 | ('Scrollbar_width', 20), 53 | ('text_selectborderwidth', 2), 54 | ('text_state', 'disabled'), 55 | ('text_state', 'normal'), 56 | ('text_background', 'GhostWhite'), 57 | ('text_wrap', 'char'), 58 | ('text_wrap', 'none'), 59 | ('vscrollmode', 'bogus', 'ValueError: bad vscrollmode ' + 60 | 'option "bogus": should be static, dynamic, or none'), 61 | ('hscrollmode', 'bogus', 'ValueError: bad hscrollmode ' + 62 | 'option "bogus": should be static, dynamic, or none'), 63 | (c.cget, 'vscrollmode', 'bogus'), 64 | (c.cget, 'hscrollmode', 'bogus'), 65 | ('vscrollmode', 'dynamic'), 66 | ('hscrollmode', 'dynamic'), 67 | (c.insert, ('end', 'Hello there\n')), 68 | (_testYView, 0), 69 | (c.yview, ('moveto', 0.02)), 70 | (c.yview, ('moveto', 0.04)), 71 | (c.yview, ('moveto', 0.06)), 72 | (c.yview, ('moveto', 0.08)), 73 | (c.yview, ('moveto', 0.10)), 74 | (c.yview, ('moveto', 0.12)), 75 | (c.yview, ('moveto', 0.14)), 76 | (c.yview, ('moveto', 0.16)), 77 | (c.yview, ('moveto', 0.18)), 78 | (c.yview, ('moveto', 0.20)), 79 | (c.yview, ('moveto', 0.22)), 80 | (c.yview, ('moveto', 0.24)), 81 | (c.yview, ('moveto', 0.26)), 82 | (c.yview, ('moveto', 0.28)), 83 | (c.yview, ('moveto', 0.98)), 84 | (_testYView, 1), 85 | (c.yview, ('scroll', -1, 'page')), 86 | (c.yview, ('scroll', -50, 'page')), 87 | (_testYView, 0), 88 | (c.yview, ('scroll', 1, 'page')), 89 | (c.yview, ('scroll', 50, 'page')), 90 | (_testYView, 1), 91 | (c.clear, ()), 92 | (c.get, (), '\n'), 93 | ) 94 | 95 | kw_2 = { 96 | 'hscrollmode' : 'dynamic', 97 | 'label_text' : 'Label', 98 | 'labelpos' : 'n', 99 | 'scrollmargin': 20, 100 | } 101 | tests_2 = ( 102 | (c.pack, (), {'padx' : 10, 'pady' : 10, 'fill' : 'both', 'expand' : 1}), 103 | (c.importfile, 'ScrolledText_test.py'), 104 | ('text_relief', 'raised'), 105 | ('text_relief', 'sunken'), 106 | ) 107 | 108 | alltests = ( 109 | (tests_1, kw_1), 110 | (tests_2, kw_2), 111 | ) 112 | 113 | testData = ((Pmw.ScrolledText, alltests),) 114 | 115 | if __name__ == '__main__': 116 | Test.runTests(testData) 117 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/SelectionDialog_test.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Test 3 | import Pmw 4 | 5 | Test.initialise() 6 | 7 | c = Pmw.SelectionDialog 8 | 9 | kw_1 = { 10 | 'scrolledlist_labelpos': 'n', 11 | 'label_text' : 'Please select one', 12 | 'buttons' : ('OK', 'Cancel'), 13 | 'buttonbox_padx': 30, 14 | } 15 | tests_1 = ( 16 | (Test.num_options, (), 11), 17 | ('hull_background', '#d9d9d9'), 18 | (c.insert, ('end', 'Calling', 'all', 'cars')), 19 | ('label_bitmap', 'warning'), 20 | ('hull_cursor', 'gumby'), 21 | ('label_image', Test.flagup), 22 | ('listbox_font', Test.font['variable']), 23 | ('listbox_foreground', 'red'), 24 | ('listbox_selectmode', 'multiple'), 25 | ('label_image', ''), 26 | ('label_bitmap', ''), 27 | (c.title, 'SelectionDialog 1: new title', ''), 28 | (c.interior, (), tkinter.Frame), 29 | ('defaultbutton', 'OK'), 30 | (c.delete, (0, 'end')), 31 | (c.get, (0, 'end'), ()), 32 | (c.insert, ('end', 'Test', 'Test', 'Long String Test')), 33 | (c.get, (0, 'end'), ('Test', 'Test', 'Long String Test')), 34 | (c.insert, (0, 'Test', 'Test A')), 35 | (c.get, (0, 'end'), ('Test', 'Test A', 'Test', 'Test', 'Long String Test')), 36 | (c.insert, (1, 'Test', 'Test', 'Long String Test')), 37 | (c.get, (0, 4), ('Test', 'Test', 'Test', 'Long String Test', 'Test A')), 38 | (c.insert, (5, 'Test', 'Test', 39 | 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')), 40 | (c.get, 7, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'), 41 | (c.get, 'end', 'Long String Test'), 42 | (c.size, (), 11), 43 | (c.delete, (3, 2)), 44 | (c.size, (), 11), 45 | (c.delete, (3, 3)), 46 | (c.size, (), 10), 47 | (c.clear, ()), 48 | (c.size, (), 0), 49 | (c.get, (), ()), 50 | ) 51 | 52 | kw_2 = { 53 | 'buttons' : ('OK', 'Cancel'), 54 | 'buttonboxpos': 'e', 55 | 'scrolledlist_labelpos': 'n', 56 | } 57 | tests_2 = ( 58 | (c.title, 'SelectionDialog 2', ''), 59 | ) 60 | 61 | alltests = ( 62 | (tests_1, kw_1), 63 | (tests_2, kw_2), 64 | ) 65 | 66 | testData = ((c, alltests),) 67 | 68 | if __name__ == '__main__': 69 | Test.runTests(testData) 70 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/TestVersion.py: -------------------------------------------------------------------------------- 1 | # Set the version of Pmw to use for the tests based on the directory 2 | # name. 3 | 4 | import imp 5 | import os 6 | import string 7 | import Pmw 8 | 9 | file = imp.find_module(__name__)[1] 10 | if not os.path.isabs(file): 11 | file = os.path.join(os.getcwd(), file) 12 | file = os.path.normpath(file) 13 | 14 | dir = os.path.dirname(file) 15 | dir = os.path.dirname(dir) 16 | dir = os.path.basename(dir) 17 | 18 | version = str.replace(dir[4:], '_', '.') 19 | Pmw.setversion(version) 20 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/TextDialog_test.py: -------------------------------------------------------------------------------- 1 | import tkinter 2 | import Test 3 | import Pmw 4 | 5 | Test.initialise() 6 | 7 | c = Pmw.TextDialog 8 | 9 | kw_1 = { 10 | 'scrolledtext_labelpos': 'n', 11 | 'label_text' : 'Here is the news', 12 | 'buttons' : ('OK', 'Cancel'), 13 | 'buttonbox_padx': 30, 14 | } 15 | tests_1 = ( 16 | (Test.num_options, (), 11), 17 | ('text_wrap', 'none'), 18 | ('text_state', 'disabled'), 19 | ('hull_background', '#d9d9d9'), 20 | ('label_bitmap', 'warning'), 21 | ('hull_cursor', 'gumby'), 22 | ('label_image', Test.flagup), 23 | ('text_font', Test.font['variable']), 24 | ('text_foreground', 'red'), 25 | ('text_padx', 15), 26 | ('text_pady', 15), 27 | ('label_image', ''), 28 | ('label_bitmap', ''), 29 | (c.title, 'TextDialog 1: new title', ''), 30 | (c.interior, (), tkinter.Frame), 31 | ('defaultbutton', 'OK'), 32 | (c.clear, ()), 33 | (c.get, (), '\n'), 34 | ) 35 | 36 | kw_2 = { 37 | 'buttons' : ('OK', 'Cancel'), 38 | 'buttonboxpos': 'e', 39 | 'scrolledtext_labelpos': 'n', 40 | } 41 | tests_2 = ( 42 | (c.title, 'TextDialog 2', ''), 43 | ) 44 | 45 | alltests = ( 46 | (tests_1, kw_1), 47 | (tests_2, kw_2), 48 | ) 49 | 50 | testData = ((c, alltests),) 51 | 52 | if __name__ == '__main__': 53 | Test.runTests(testData) 54 | -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/earthris.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/Pmw/Pmw_2_0_1/tests/earthris.gif -------------------------------------------------------------------------------- /Pmw/Pmw_2_0_1/tests/flagup.bmp: -------------------------------------------------------------------------------- 1 | #define flagup_width 48 2 | #define flagup_height 48 3 | static char flagup_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 5 | 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00, 6 | 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00, 7 | 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00, 8 | 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00, 9 | 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00, 10 | 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00, 11 | 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00, 12 | 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00, 13 | 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00, 14 | 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 15 | 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00, 16 | 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00, 17 | 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00, 18 | 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00, 19 | 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a, 20 | 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a, 21 | 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a, 22 | 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 23 | 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 24 | 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 25 | 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a, 26 | 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a, 27 | 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 28 | -------------------------------------------------------------------------------- /Pmw/README: -------------------------------------------------------------------------------- 1 | 2 | Python megawidgets 3 | 4 | Pmw is a toolkit for building high-level compound widgets in 5 | Python using the Tkinter module. 6 | 7 | All documentation about Pmw is in the form of html files stored in 8 | the 'doc' directory of each release of Pmw. Please use your Web 9 | browser to view the file 'doc/index.html' in the directory 10 | containing the most recent release. 11 | -------------------------------------------------------------------------------- /Pmw/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is executed when the Pmw package is imported. It creates 2 | # a lazy importer/dynamic loader for Pmw and replaces the Pmw module 3 | # with it. Even though the loader from the most recent installed 4 | # version of Pmw is used, the user is able to specify which version of 5 | # Pmw megawidgets to load by using the setversion() function of the 6 | # loader. 7 | 8 | # This is the only file in Pmw which is not part of a particular Pmw 9 | # release. 10 | 11 | import sys 12 | import os 13 | import re 14 | 15 | def _hasLoader(dir): 16 | if dir.startswith('Pmw_2_') and sys.version_info < (3, 0): 17 | return 0 18 | 19 | # Only accept Pmw_V_R_P with single digits, since ordering will 20 | # not work correctly with multiple digits (for example, Pmw_10_0 21 | # will be before Pmw_9_9). 22 | if re.search('^Pmw_[0-9]_[0-9](_[0-9])?$', dir) is not None: 23 | for suffix in ('.py', '.pyc', '.pyo'): 24 | path = os.path.join(_dir, dir, 'lib', 'PmwLoader' + suffix) 25 | if os.path.isfile(path): 26 | return 1 27 | return 0 28 | 29 | # First get a list of all subdirectories containing versions of Pmw. 30 | _dir = __path__[0] 31 | _listdir = os.listdir(_dir) 32 | _instdirs = list(filter(_hasLoader, _listdir)) 33 | _instdirs.sort() 34 | _instdirs.reverse() 35 | 36 | # Using the latest version import the dynamic loader. 37 | _loader = 'Pmw.' + _instdirs[0] + '.lib.PmwLoader' 38 | __import__(_loader) 39 | _mod = sys.modules[_loader] 40 | 41 | # Create the dynamic loader and install it into sys.modules. 42 | sys.modules['_Pmw'] = sys.modules['Pmw'] 43 | sys.modules['Pmw'] = _mod.PmwLoader(_dir, _instdirs, _listdir) 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository contains a CMake script to build the thirdparty packages that 2 | are necessary for building Panda3D. 3 | 4 | Usage example on Windows: 5 | 6 | mkdir build 7 | cd build 8 | cmake -G"Visual Studio 16 2019" -A x64 .. 9 | 10 | # to build everything: 11 | cmake --build . --config Release 12 | 13 | # to just build ffmpeg and its dependencies: 14 | cmake --build . --config Release --target ffmpeg 15 | 16 | Usage example on other systems: 17 | 18 | mkdir build 19 | cd build 20 | cmake .. 21 | make ffmpeg # just build ffmpeg and dependencies 22 | make all # build everything 23 | 24 | Some packages are still forthcoming. The included packages are ticked. 25 | - [x] artoolkit 26 | - [x] assimp 27 | - [x] bullet 28 | - [x] eigen 29 | - [x] fcollada 30 | - [x] ffmpeg 31 | - [ ] fmodex 32 | - [x] freetype 33 | - [x] harfbuzz 34 | - [x] jpeg 35 | - [x] mimalloc 36 | - [x] nvidiacg (except arm64 or Android) 37 | - [x] ode 38 | - [x] openal 39 | - [x] opencv (macOS only) 40 | - [x] openexr 41 | - [x] openssl 42 | - [x] opus 43 | - [x] png 44 | - [x] squish 45 | - [x] tiff 46 | - [x] vorbis 47 | - [x] vrpn 48 | - [x] zlib 49 | 50 | 51 | If you want to build a subset of packages, it is easiest to just pass the name 52 | of the target to the build system. For example, to just build VRPN, you can 53 | call `make vrpn` or add the `--target vrpn` flag to `cmake --build`. 54 | This will still build its dependencies if one package depends on another one. 55 | A way to force a certain package to be disabled is by using the `BUILD_*` 56 | options, eg. `-DBUILD_VRPN=OFF` disables building VRPN, even if it is a 57 | dependency of another package. 58 | -------------------------------------------------------------------------------- /artoolkit.cmake: -------------------------------------------------------------------------------- 1 | # Made by rdb, released in the public domain. 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | project(artoolkit) 5 | 6 | option(BUILD_SHARED_LIBS "Enable to build libAR as a shared library." OFF) 7 | option(AR_OPENGL_TEXTURE_RECTANGLE "Enable to build gsub libraries with GL_NV_texture_rectangle support." OFF) 8 | 9 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 10 | option(AR_INPUT_V4L "Use Video4Linux video capture driver." ON) 11 | option(AR_INPUT_DV "Use Digital Video Camcoder through IEEE 1394 (DV Format) capture driver." OFF) 12 | option(AR_INPUT_1394CAM "Use Digital Video Camera through IEEE 1394 (VGA NONCOMPRESSED Image Format) capture driver." OFF) 13 | option(AR_INPUT_GSTREAMER "Use GStreamer Media Framework capture driver." OFF) 14 | endif() 15 | 16 | if(APPLE) 17 | option(APPLE_TEXTURE_FAST_TRANSFER "Set if your Mac has fast texture mapping hardware." OFF) 18 | endif() 19 | 20 | configure_file(include/AR/config.h.cmake AR/config.h) 21 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 22 | include_directories(include) 23 | 24 | set(AR_SOURCES 25 | lib/SRC/AR/arDetectMarker.c 26 | lib/SRC/AR/arDetectMarker2.c 27 | lib/SRC/AR/arGetCode.c 28 | lib/SRC/AR/arGetMarkerInfo.c 29 | lib/SRC/AR/arGetTransMat.c 30 | lib/SRC/AR/arGetTransMat2.c 31 | lib/SRC/AR/arGetTransMat3.c 32 | lib/SRC/AR/arGetTransMatCont.c 33 | lib/SRC/AR/arLabeling.c 34 | lib/SRC/AR/arUtil.c 35 | lib/SRC/AR/mAlloc.c 36 | lib/SRC/AR/mAllocDup.c 37 | lib/SRC/AR/mAllocInv.c 38 | lib/SRC/AR/mAllocMul.c 39 | lib/SRC/AR/mAllocTrans.c 40 | lib/SRC/AR/mAllocUnit.c 41 | lib/SRC/AR/mDet.c 42 | lib/SRC/AR/mDisp.c 43 | lib/SRC/AR/mDup.c 44 | lib/SRC/AR/mFree.c 45 | lib/SRC/AR/mInv.c 46 | lib/SRC/AR/mMul.c 47 | lib/SRC/AR/mPCA.c 48 | lib/SRC/AR/mSelfInv.c 49 | lib/SRC/AR/mTrans.c 50 | lib/SRC/AR/mUnit.c 51 | lib/SRC/AR/paramChangeSize.c 52 | lib/SRC/AR/paramDecomp.c 53 | lib/SRC/AR/paramDisp.c 54 | lib/SRC/AR/paramDistortion.c 55 | lib/SRC/AR/paramFile.c 56 | lib/SRC/AR/paramGet.c 57 | lib/SRC/AR/vAlloc.c 58 | lib/SRC/AR/vDisp.c 59 | lib/SRC/AR/vFree.c 60 | lib/SRC/AR/vHouse.c 61 | lib/SRC/AR/vInnerP.c 62 | lib/SRC/AR/vTridiag.c 63 | ) 64 | 65 | set(ARMULTI_SOURCES 66 | lib/SRC/ARMulti/arMultiActivate.c 67 | lib/SRC/ARMulti/arMultiGetTransMat.c 68 | lib/SRC/ARMulti/arMultiReadConfigFile.c 69 | ) 70 | 71 | if(MSVC) 72 | add_library(libAR ${AR_SOURCES}) 73 | add_library(libARMulti ${ARMULTI_SOURCES}) 74 | install(TARGETS libAR libARMulti DESTINATION lib) 75 | else() 76 | add_library(AR ${AR_SOURCES}) 77 | add_library(ARMulti ${ARMULTI_SOURCES}) 78 | install(TARGETS AR ARMulti DESTINATION lib) 79 | endif() 80 | 81 | install(FILES 82 | ${CMAKE_CURRENT_BINARY_DIR}/AR/config.h 83 | include/AR/ar.h 84 | include/AR/arMulti.h 85 | include/AR/arvrml.h 86 | include/AR/gsub.h 87 | include/AR/gsub_lite.h 88 | include/AR/gsubUtil.h 89 | include/AR/matrix.h 90 | include/AR/param.h 91 | include/AR/video.h 92 | DESTINATION include/AR 93 | ) 94 | 95 | install(FILES 96 | ${CMAKE_CURRENT_BINARY_DIR}/AR/config.h 97 | include/AR/ar.h 98 | include/AR/arMulti.h 99 | include/AR/arvrml.h 100 | include/AR/gsub.h 101 | include/AR/gsub_lite.h 102 | include/AR/gsubUtil.h 103 | include/AR/matrix.h 104 | include/AR/param.h 105 | include/AR/video.h 106 | DESTINATION include/AR 107 | ) 108 | 109 | install(FILES 110 | include/AR/sys/videoGStreamer.h 111 | include/AR/sys/videoLinux1394Cam.h 112 | include/AR/sys/videoLinuxDV.h 113 | include/AR/sys/videoLinuxV4L.h 114 | include/AR/sys/videoMacOSX.h 115 | include/AR/sys/videoSGI.h 116 | include/AR/sys/videoWin32DirectShow.h 117 | DESTINATION include/AR/sys 118 | ) 119 | -------------------------------------------------------------------------------- /install-python.ps1: -------------------------------------------------------------------------------- 1 | # WARNING: Due to the limitation that the Python Windows installer only 2 | # supports a single installation per system, this script will uninstall 3 | # versions of Python already present on your system! 4 | 5 | $versions = "3.8.10","3.9.13","3.10.11","3.11.9","3.12.7","3.13.0" 6 | $installerargs = "/quiet","/repair","InstallAllUsers=0","Include_doc=0","Include_pip=0","Include_test=0","Include_launcher=0","Include_freethreaded=1","InstallLauncherAllUsers=0","Shortcuts=0","AssociateFiles=0" 7 | $packages = "pytest","pip","setuptools" 8 | 9 | $temp = Join-Path ([System.IO.Path]::GetTempPath()) $(New-Guid) 10 | New-Item -Type Directory -Path $temp | Out-Null 11 | 12 | $wc = New-Object Net.WebClient 13 | 14 | $installersuffix = "" 15 | $dirsuffix = "" 16 | if ($args[0] -match '64$') 17 | { 18 | $installersuffix = "-amd64" 19 | $dirsuffix = "-x64" 20 | } 21 | 22 | $env:PYTHONDONTWRITEBYTECODE = "1" 23 | 24 | foreach ($version in $versions) 25 | { 26 | $url = "https://www.python.org/ftp/python/$version/python-$version$installersuffix.exe" 27 | $installer = "$temp\python-$version$installersuffix.exe" 28 | $minor = "$(([version]$version).Major).$(([version]$version).Minor)" 29 | $installdir = "$temp\win-python$minor$dirsuffix" 30 | $destination = "$pwd\win-python$minor$dirsuffix" 31 | 32 | Write-Host "Downloading $url..." 33 | $wc.DownloadFile($url, $installer) 34 | 35 | Write-Host "Installing to $installdir..." 36 | Start-Process -Wait $installer -ArgumentList ($installerargs+"TargetDir=$installdir") 37 | 38 | if (-Not (Test-Path $installdir)) 39 | { 40 | # Didn't work, most likely this version of Python is already installed. 41 | Write-Host "Uninstalling existing Python $version installation..." 42 | Start-Process -Wait $installer -ArgumentList "/uninstall","/quiet" 43 | if (Test-Path $installdir) 44 | { 45 | Remove-Item -Recurse -Force $installdir 46 | } 47 | 48 | Write-Host "Re-installing to $installdir..." 49 | Start-Process -Wait $installer -ArgumentList ($installerargs+"TargetDir=$installdir") 50 | } 51 | 52 | Write-Host "Installing pip packages..." 53 | Start-Process -Wait $installdir\python.exe -NoNewWindow -ArgumentList "-B","-m","ensurepip" 54 | Start-Process -Wait $installdir\python.exe -NoNewWindow -ArgumentList (@("-B","-m","pip","install")+$packages) 55 | 56 | Write-Host "Deleting __pycache__ directories..." 57 | Get-ChildItem $installdir -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse 58 | 59 | Write-Host "Copying to $destination..." 60 | if (Test-Path $destination) 61 | { 62 | Remove-Item -Recurse -Force $destination 63 | } 64 | Copy-Item $installdir -Destination $destination -Recurse 65 | 66 | Write-Host "Running uninstaller..." 67 | Start-Process -Wait $installer -ArgumentList "/uninstall","/quiet" 68 | } 69 | 70 | Remove-Item -Recurse -Force $temp 71 | 72 | Write-Host "Done!" 73 | -------------------------------------------------------------------------------- /libjpeg.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007-2012 LuaDist. 2 | # Created by Peter Kapec, David Manura 3 | # Modified by rdb to not depend on cmake/dist.cmake 4 | # Redistribution and use of this file is allowed according to the terms of the MIT license. 5 | # For details see the COPYRIGHT file distributed with LuaDist. 6 | # Please note that the package source code is licensed under its own license. 7 | 8 | project ( libjpeg C ) 9 | cmake_minimum_required ( VERSION 2.8 ) 10 | 11 | option(BUILD_SHARED_LIBS "Build shared instead of static library." OFF) 12 | 13 | include ( CheckIncludeFile ) 14 | check_include_file ( stddef.h HAVE_STDDEF_H ) 15 | check_include_file ( stdlib.h HAVE_STDLIB_H ) 16 | if ( WIN32 AND NOT CYGWIN ) 17 | #improve? see jconfig.* 18 | set ( TWO_FILE_COMMANDLINE true ) 19 | # jconfig.h 20 | endif ( ) 21 | configure_file ( jconfig.h.cmake jconfig.h ) 22 | 23 | include_directories ( ${CMAKE_CURRENT_BINARY_DIR} ) 24 | # jconfig.h 25 | 26 | set ( HEADERS jerror.h jmorecfg.h jpeglib.h ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h ) 27 | 28 | set ( SRC jmemnobs.c jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c 29 | jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c 30 | jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdarith.c jdatadst.c jdatasrc.c 31 | jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c 32 | jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c 33 | jidctflt.c jidctfst.c jidctint.c jquant1.c jquant2.c jutils.c jmemmgr.c cderror.h 34 | cdjpeg.h jdct.h jinclude.h jmemsys.h jpegint.h jversion.h transupp.h ) 35 | 36 | if(MSVC AND NOT BUILD_SHARED_LIBS) 37 | add_library(jpeg-static STATIC ${SRC} ${HEADERS}) 38 | install(TARGETS jpeg-static DESTINATION lib) 39 | else() 40 | add_library (jpeg ${SRC} ${HEADERS}) 41 | install(TARGETS jpeg DESTINATION lib) 42 | endif() 43 | 44 | install(FILES ${HEADERS} DESTINATION include) 45 | -------------------------------------------------------------------------------- /libopusfile.cmake: -------------------------------------------------------------------------------- 1 | # adapted from https://github.com/eppixx/opusfile-cmake 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | project(opusfile) 5 | 6 | find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${OGG_ROOT}/include PATH_SUFFIXES ogg) 7 | find_library(OGG_LIBRARIES NAMES ogg HINTS ${OGG_ROOT}/lib ${OGG_ROOT}/lib64) 8 | find_path(OPUS_INCLUDE_DIRS NAMES opus.h HINTS ${OPUS_ROOT}/include PATH_SUFFIXES opus) 9 | find_library(OPUS_LIBRARIES NAMES opus HINTS ${OPUS_ROOT}/lib ${OPUS_ROOT}/lib64) 10 | 11 | set(OPUSFILE_LIBS 12 | ${OPUSFILE_LIBS} 13 | ${OGG_LIBRARIES} 14 | ${OPUS_LIBRARIES} 15 | m 16 | ) 17 | 18 | set(OPUSFILE_INCLUDE_DIRS 19 | include 20 | ) 21 | 22 | set(OPUSFILE_HDR 23 | include/opusfile.h 24 | ) 25 | 26 | set(OPUSFILE_SRC 27 | src/http.c 28 | src/info.c 29 | src/internal.c 30 | src/internal.h 31 | src/opusfile.c 32 | src/stream.c 33 | src/wincerts.c 34 | src/winerrno.h 35 | ) 36 | 37 | set(OPUSFILE_CODE 38 | ${OPUSFILE_SRC} 39 | ${OPUSFILE_HDR} 40 | ) 41 | 42 | # These options affect performance 43 | # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion 44 | add_definitions(-DHAVE_LRINTF) 45 | 46 | if(MINGW) 47 | set(CMAKE_C_FLAGS 48 | "${CMAKE_C_FLAGS} -U__STRICT_ANSI__" 49 | ) 50 | endif(MINGW) 51 | 52 | add_library(opusfile STATIC ${OPUSFILE_CODE}) 53 | target_link_libraries(opusfile ${OPUSFILE_LIBS}) 54 | 55 | target_compile_options(opusfile PRIVATE $<$,$>: 56 | -std=c89 57 | -pedantic 58 | -Wall 59 | -Wextra 60 | -Wno-parentheses 61 | -Wno-long-long 62 | >) 63 | target_include_directories(opusfile PRIVATE 64 | ${CMAKE_CURRENT_SOURCE_DIR}/include 65 | ${CMAKE_CURRENT_SOURCE_DIR}/src 66 | ) 67 | target_include_directories(opusfile PUBLIC 68 | ${OPUSFILE_INCLUDE_DIRS} 69 | ${OGG_INCLUDE_DIRS} 70 | ${OPUS_INCLUDE_DIRS} 71 | ) 72 | 73 | install(TARGETS opusfile DESTINATION lib) 74 | install(FILES ${OPUSFILE_HDR} DESTINATION include/opus) 75 | -------------------------------------------------------------------------------- /libsquish.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(squish) 3 | 4 | # By default, enable SSE2 instructions on x64. 5 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 6 | if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") 7 | set(DEFAULT_SSE OFF) 8 | elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") 9 | set(DEFAULT_SSE OFF) 10 | else() 11 | set(DEFAULT_SSE ON) 12 | endif() 13 | else() 14 | set(DEFAULT_SSE OFF) 15 | endif() 16 | 17 | option(USE_ALTIVEC "Define to 1 to use Altivec instructions" OFF) 18 | option(USE_SSE "Define to 1 to use SSE2 instructions" ${DEFAULT_SSE}) 19 | option(BUILD_SHARED_LIBS "Define to build libsquish as shared library" OFF) 20 | 21 | if(MSVC) 22 | set(CMAKE_DEBUG_POSTFIX d CACHE STRING "Suffix to add to the library name in debug builds") 23 | 24 | if(USE_SSE) 25 | add_definitions(/arch:SSE2 /DSQUISH_USE_SSE=2) 26 | endif() 27 | else() 28 | if(USE_ALTIVEC) 29 | add_definitions(-maltivec -DSQUISH_USE_ALTIVEC=1) 30 | endif() 31 | if(USE_SSE) 32 | add_definitions(-msse -msse2 -DSQUISH_USE_SSE=2) 33 | endif() 34 | 35 | # Easiest way to solve a missing include of limits.h. 36 | add_definitions(-DINT_MAX=2147483647) 37 | endif() 38 | 39 | set(SRC alpha.cpp clusterfit.cpp colourblock.cpp colourfit.cpp colourset.cpp maths.cpp rangefit.cpp singlecolourfit.cpp squish.cpp) 40 | 41 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 42 | 43 | add_library(squish ${SRC}) 44 | 45 | install(FILES squish.h DESTINATION include) 46 | install(TARGETS squish DESTINATION lib) 47 | 48 | -------------------------------------------------------------------------------- /patches/assimp-5.1.6-no-werror.patch: -------------------------------------------------------------------------------- 1 | diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt 2 | index 08efd28df..e7cab6dc6 100644 3 | --- a/code/CMakeLists.txt 4 | +++ b/code/CMakeLists.txt 5 | @@ -1168,7 +1168,6 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) 6 | IF (MSVC) 7 | TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) 8 | ELSE() 9 | - TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) 10 | ENDIF() 11 | 12 | # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler 13 | diff --git a/contrib/zip/CMakeLists.txt b/contrib/zip/CMakeLists.txt 14 | index bba4e7bde..98842b5e5 100644 15 | --- a/contrib/zip/CMakeLists.txt 16 | +++ b/contrib/zip/CMakeLists.txt 17 | @@ -45,7 +45,7 @@ if (MSVC) 18 | elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR 19 | "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR 20 | "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") 21 | - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Werror -pedantic -Wno-deprecated") 22 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -pedantic -Wno-deprecated") 23 | endif (MSVC) 24 | 25 | #### 26 | -------------------------------------------------------------------------------- /patches/bullet-btvector3-shuffle.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h 2 | index 839b19c14..4c854dd0e 100644 3 | --- a/src/LinearMath/btVector3.h 4 | +++ b/src/LinearMath/btVector3.h 5 | @@ -39,7 +39,7 @@ subject to the following restrictions: 6 | #endif 7 | 8 | 9 | -#define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x)) 10 | +#define BT_SHUFFLE(x,y,z,w) (((w)<<6 | (z)<<4 | (y)<<2 | (x)) & 0xff) 11 | //#define bt_pshufd_ps( _a, _mask ) (__m128) _mm_shuffle_epi32((__m128i)(_a), (_mask) ) 12 | #define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) ) 13 | #define bt_splat3_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i, 3) ) 14 | -------------------------------------------------------------------------------- /patches/eigen-3.3.9-bad-alloc.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h 2 | --- a/Eigen/src/Core/util/Memory.h 2022-02-06 22:52:38.738752800 +0100 3 | +++ b/Eigen/src/Core/util/Memory.h 2022-02-06 22:53:06.852422200 +0100 4 | @@ -69,8 +69,7 @@ 5 | #ifdef EIGEN_EXCEPTIONS 6 | throw std::bad_alloc(); 7 | #else 8 | - std::size_t huge = static_cast(-1); 9 | - ::operator new(huge); 10 | + abort(); 11 | #endif 12 | } 13 | 14 | -------------------------------------------------------------------------------- /patches/freetype-2.7.1-harfbuzz-icu.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake 2 | --- a/builds/cmake/FindHarfBuzz.cmake 2022-02-05 16:09:17.087419136 +0100 3 | +++ b/builds/cmake/FindHarfBuzz.cmake 2022-02-05 16:09:38.440814613 +0100 4 | @@ -49,14 +49,15 @@ 5 | else () 6 | set(_HARFBUZZ_REQUIRED "") 7 | endif () 8 | - pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 ${_HARFBUZZ_REQUIRED}) 9 | - find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu 10 | - HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR} 11 | - ) 12 | - if (HARFBUZZ_ICU_LIBRARIES) 13 | - list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}") 14 | - endif () 15 | - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "HARFBUZZ_ICU_LIBRARIES") 16 | + #pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 ${_HARFBUZZ_REQUIRED}) 17 | + #find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu 18 | + # HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR} 19 | + #) 20 | + #if (HARFBUZZ_ICU_LIBRARIES) 21 | + # list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}") 22 | + #endif () 23 | + #set(_HARFBUZZ_EXTRA_REQUIRED_VAR "HARFBUZZ_ICU_LIBRARIES") 24 | + set(_HARFBUZZ_EXTRA_REQUIRED_VAR "") 25 | else () 26 | set(_HARFBUZZ_EXTRA_REQUIRED_VAR "") 27 | endif () 28 | -------------------------------------------------------------------------------- /patches/harfbuzz-2.6-remove-dead-code.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/src/hb-coretext.cc b/src/hb-coretext.cc 2 | --- a/src/hb-coretext.cc 2022-10-26 13:08:34.203560322 +0200 3 | +++ b/src/hb-coretext.cc 2022-10-26 13:09:20.141215924 +0200 4 | @@ -802,7 +802,7 @@ 5 | DEBUG_MSG (CORETEXT, nullptr, "Num runs: %d", num_runs); 6 | 7 | buffer->len = 0; 8 | - uint32_t status_and = ~0, status_or = 0; 9 | + uint32_t status_or = 0; 10 | double advances_so_far = 0; 11 | /* For right-to-left runs, CoreText returns the glyphs positioned such that 12 | * any trailing whitespace is to the left of (0,0). Adjust coordinate system 13 | @@ -823,7 +823,6 @@ 14 | CTRunRef run = static_cast(CFArrayGetValueAtIndex (glyph_runs, i)); 15 | CTRunStatus run_status = CTRunGetStatus (run); 16 | status_or |= run_status; 17 | - status_and &= run_status; 18 | DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status); 19 | double run_advance = CTRunGetTypographicBounds (run, range_all, nullptr, nullptr, nullptr); 20 | if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction)) 21 | @@ -1045,21 +1044,6 @@ 22 | buffer->len += num_glyphs; 23 | } 24 | 25 | - /* Mac OS 10.6 doesn't have kCTTypesetterOptionForcedEmbeddingLevel, 26 | - * or if it does, it doesn't respect it. So we get runs with wrong 27 | - * directions. As such, disable the assert... It wouldn't crash, but 28 | - * cursoring will be off... 29 | - * 30 | - * https://crbug.com/419769 31 | - */ 32 | - if (false) 33 | - { 34 | - /* Make sure all runs had the expected direction. */ 35 | - HB_UNUSED bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction); 36 | - assert (bool (status_and & kCTRunStatusRightToLeft) == backward); 37 | - assert (bool (status_or & kCTRunStatusRightToLeft) == backward); 38 | - } 39 | - 40 | buffer->clear_positions (); 41 | 42 | unsigned int count = buffer->len; 43 | -------------------------------------------------------------------------------- /patches/opencv-2.4.3-highgui-avfoundation.patch: -------------------------------------------------------------------------------- 1 | diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt 2 | index b4b2896d7a..30145913e4 100644 3 | --- a/modules/highgui/CMakeLists.txt 4 | +++ b/modules/highgui/CMakeLists.txt 5 | @@ -186,10 +186,10 @@ if(WITH_IMAGEIO) 6 | endif() 7 | endif(WITH_IMAGEIO) 8 | 9 | -if(WITH_AVFOUNDATION) 10 | +if(APPLE) 11 | add_definitions(-DHAVE_AVFOUNDATION=1) 12 | list(APPEND highgui_srcs src/cap_avfoundation.mm) 13 | - list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore") 14 | + list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore" "-framework CoreMedia") 15 | elseif(APPLE) 16 | add_definitions(-DHAVE_QUICKTIME=1) 17 | if(WITH_QUICKTIME) 18 | 19 | -------------------------------------------------------------------------------- /patches/openssl-1.1.1-no-pdb.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/Configurations/10-main.conf b/Configurations/10-main.conf 2 | --- a/Configurations/10-main.conf 2022-02-06 14:31:32.462948300 +0100 3 | +++ b/Configurations/10-main.conf 2022-02-06 14:33:43.177248800 +0100 4 | @@ -13,7 +13,7 @@ 5 | } elsif ($disabled{asm}) { 6 | # assembler is still used to compile uplink shim 7 | $vc_win64a_info = { AS => "ml64", 8 | - ASFLAGS => "/nologo /Zi", 9 | + ASFLAGS => "/nologo", 10 | asflags => "/c /Cp /Cx", 11 | asoutflag => "/Fo" }; 12 | } else { 13 | @@ -41,7 +41,7 @@ 14 | } elsif ($disabled{asm}) { 15 | # not actually used, uplink shim is inlined into C code 16 | $vc_win32_info = { AS => "ml", 17 | - ASFLAGS => "/nologo /Zi", 18 | + ASFLAGS => "/nologo", 19 | asflags => "/Cp /coff /c /Cx", 20 | asoutflag => "/Fo", 21 | perlasm_scheme => "win32" }; 22 | @@ -1231,7 +1231,7 @@ 23 | "UNICODE", "_UNICODE", 24 | "_CRT_SECURE_NO_DEPRECATE", 25 | "_WINSOCK_DEPRECATED_NO_WARNINGS"), 26 | - lib_cflags => add("/Zi /Fdossl_static.pdb"), 27 | + lib_cflags => add(""), 28 | lib_defines => add("L_ENDIAN"), 29 | dso_cflags => "/Zi /Fddso.pdb", 30 | bin_cflags => "/Zi /Fdapp.pdb", 31 | diff -ur a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl 32 | --- a/Configurations/windows-makefile.tmpl 2022-02-06 14:31:32.549466200 +0100 33 | +++ b/Configurations/windows-makefile.tmpl 2022-02-06 14:33:04.742492300 +0100 34 | @@ -424,8 +424,6 @@ 35 | "$(INSTALLTOP)\include\openssl" 36 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)" 37 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" 38 | - @if "$(SHLIBS)"=="" \ 39 | - "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" 40 | 41 | uninstall_dev: 42 | 43 | -------------------------------------------------------------------------------- /patches/squish-1.10-sse.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/config.h b/config.h 2 | --- a/config.h 2022-02-05 17:26:37.880326316 +0100 3 | +++ b/config.h 2022-02-05 17:29:20.424103700 +0100 4 | @@ -33,6 +33,15 @@ 5 | 6 | // Set to 1 or 2 when building squish to use SSE or SSE2 instructions. 7 | #ifndef SQUISH_USE_SSE 8 | +#if defined(__x86_64__) || defined(_M_X64) || defined(__SSE2__) 9 | +#define SQUISH_USE_SSE 2 10 | +#else 11 | +#define SQUISH_USE_SSE 0 12 | +#endif 13 | +#endif 14 | + 15 | +#if defined(__aarch64__) || defined(__arm__) 16 | +#undef SQUISH_USE_SSE 17 | #define SQUISH_USE_SSE 0 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /win-util/7za.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/win-util/7za.exe -------------------------------------------------------------------------------- /win-util/bison.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/win-util/bison.exe -------------------------------------------------------------------------------- /win-util/data/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Copyright (C) 2002, 2005-2012 Free Software Foundation, Inc. 2 | 3 | # This program is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program. If not, see . 15 | 16 | dist_pkgdata_DATA = README bison.m4 \ 17 | c-like.m4 \ 18 | c-skel.m4 c.m4 yacc.c glr.c \ 19 | c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc stack.hh \ 20 | java-skel.m4 java.m4 lalr1.java 21 | 22 | m4sugardir = $(pkgdatadir)/m4sugar 23 | dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4 24 | 25 | xsltdir = $(pkgdatadir)/xslt 26 | dist_xslt_DATA = \ 27 | xslt/bison.xsl \ 28 | xslt/xml2dot.xsl \ 29 | xslt/xml2text.xsl \ 30 | xslt/xml2xhtml.xsl 31 | -------------------------------------------------------------------------------- /win-util/data/README: -------------------------------------------------------------------------------- 1 | -*- outline -*- 2 | 3 | This directory contains data needed by Bison. 4 | 5 | * Skeletons 6 | Bison skeletons: the general shapes of the different parser kinds, 7 | that are specialized for specific grammars by the bison program. 8 | 9 | Currently, the supported skeletons are: 10 | 11 | - yacc.c 12 | It used to be named bison.simple: it corresponds to C Yacc 13 | compatible LALR(1) parsers. 14 | 15 | - lalr1.cc 16 | Produces a C++ parser class. 17 | 18 | - lalr1.java 19 | Produces a Java parser class. 20 | 21 | - glr.c 22 | A Generalized LR C parser based on Bison's LALR(1) tables. 23 | 24 | - glr.cc 25 | A Generalized LR C++ parser. Actually a C++ wrapper around glr.c. 26 | 27 | These skeletons are the only ones supported by the Bison team. 28 | Because the interface between skeletons and the bison program is not 29 | finished, *we are not bound to it*. In particular, Bison is not 30 | mature enough for us to consider that ``foreign skeletons'' are 31 | supported. 32 | 33 | * m4sugar 34 | This directory contains M4sugar, sort of an extended library for M4, 35 | which is used by Bison to instantiate the skeletons. 36 | 37 | * xslt 38 | This directory contains XSLT programs that transform Bison's XML output 39 | into various formats. 40 | 41 | - bison.xsl 42 | A library of routines used by the other XSLT programs. 43 | 44 | - xml2dot.xsl 45 | Conversion into GraphViz's dot format. 46 | 47 | - xml2text.xsl 48 | Conversion into text. 49 | 50 | - xml2xhtml.xsl 51 | Conversion into XHTML. 52 | 53 | ----- 54 | 55 | Copyright (C) 2002, 2008-2012 Free Software Foundation, Inc. 56 | 57 | This file is part of GNU Bison. 58 | 59 | This program is free software: you can redistribute it and/or modify 60 | it under the terms of the GNU General Public License as published by 61 | the Free Software Foundation, either version 3 of the License, or 62 | (at your option) any later version. 63 | 64 | This program is distributed in the hope that it will be useful, 65 | but WITHOUT ANY WARRANTY; without even the implied warranty of 66 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 67 | GNU General Public License for more details. 68 | 69 | You should have received a copy of the GNU General Public License 70 | along with this program. If not, see . 71 | -------------------------------------------------------------------------------- /win-util/data/c++-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # C++ skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc. 6 | 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) 21 | b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) 22 | 23 | m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]]) 24 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 25 | 26 | m4_include(b4_used_skeleton) 27 | -------------------------------------------------------------------------------- /win-util/data/c-like.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # Common code for C-like languages (C, C++, Java, etc.) 4 | 5 | # Copyright (C) 2012 Free Software Foundation, Inc. 6 | 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | # b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD) 21 | # ---------------------------------------------- 22 | # If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD", 23 | # otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a 24 | # pointer. 25 | m4_define([b4_dollar_dollar_], 26 | [m4_if([$2], [[]], 27 | [m4_ifval([$3], [($1.$3)], 28 | [$1])], 29 | [($1.$2)])]) 30 | 31 | # b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION) 32 | # b4_dollar_popdef 33 | # --------------------------------------------------------- 34 | # Define b4_dollar_dollar for VALUE and DEFAULT-FIELD, 35 | # and b4_at_dollar for LOCATION. 36 | m4_define([b4_dollar_pushdef], 37 | [m4_pushdef([b4_dollar_dollar], 38 | [b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl 39 | m4_pushdef([b4_at_dollar], [$3])dnl 40 | ]) 41 | m4_define([b4_dollar_popdef], 42 | [m4_popdef([b4_at_dollar])dnl 43 | m4_popdef([b4_dollar_dollar])dnl 44 | ]) 45 | -------------------------------------------------------------------------------- /win-util/data/c-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # C skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc. 6 | 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])]) 21 | b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])]) 22 | 23 | m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]]) 24 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 25 | 26 | m4_include(b4_used_skeleton) 27 | -------------------------------------------------------------------------------- /win-util/data/java-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # Java skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc. 6 | 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | b4_glr_if( [b4_complain([%%glr-parser not supported for Java])]) 21 | b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])]) 22 | 23 | m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]]) 24 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 25 | 26 | m4_include(b4_used_skeleton) 27 | -------------------------------------------------------------------------------- /win-util/data/stack.hh: -------------------------------------------------------------------------------- 1 | # C++ skeleton for Bison 2 | 3 | # Copyright (C) 2002-2012 Free Software Foundation, Inc. 4 | 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | m4_pushdef([b4_copyright_years], 19 | [2002-2012]) 20 | 21 | b4_output_begin([b4_dir_prefix[]stack.hh]) 22 | b4_copyright([Stack handling for Bison parsers in C++], 23 | [2002-2012])[ 24 | 25 | /** 26 | ** \file ]b4_dir_prefix[stack.hh 27 | ** Define the ]b4_namespace_ref[::stack class. 28 | */ 29 | 30 | ]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[ 31 | 32 | # include 33 | 34 | ]b4_namespace_open[ 35 | template > 36 | class stack 37 | { 38 | public: 39 | // Hide our reversed order. 40 | typedef typename S::reverse_iterator iterator; 41 | typedef typename S::const_reverse_iterator const_iterator; 42 | 43 | stack () : seq_ () 44 | { 45 | } 46 | 47 | stack (unsigned int n) : seq_ (n) 48 | { 49 | } 50 | 51 | inline 52 | T& 53 | operator [] (unsigned int i) 54 | { 55 | return seq_[i]; 56 | } 57 | 58 | inline 59 | const T& 60 | operator [] (unsigned int i) const 61 | { 62 | return seq_[i]; 63 | } 64 | 65 | inline 66 | void 67 | push (const T& t) 68 | { 69 | seq_.push_front (t); 70 | } 71 | 72 | inline 73 | void 74 | pop (unsigned int n = 1) 75 | { 76 | for (; n; --n) 77 | seq_.pop_front (); 78 | } 79 | 80 | inline 81 | unsigned int 82 | height () const 83 | { 84 | return seq_.size (); 85 | } 86 | 87 | inline const_iterator begin () const { return seq_.rbegin (); } 88 | inline const_iterator end () const { return seq_.rend (); } 89 | 90 | private: 91 | S seq_; 92 | }; 93 | 94 | /// Present a slice of the top of a stack. 95 | template > 96 | class slice 97 | { 98 | public: 99 | slice (const S& stack, unsigned int range) 100 | : stack_ (stack) 101 | , range_ (range) 102 | { 103 | } 104 | 105 | inline 106 | const T& 107 | operator [] (unsigned int i) const 108 | { 109 | return stack_[range_ - i]; 110 | } 111 | 112 | private: 113 | const S& stack_; 114 | unsigned int range_; 115 | }; 116 | ]b4_namespace_close[ 117 | 118 | ]b4_cpp_guard_close([b4_dir_prefix[]stack.hh]) 119 | b4_output_end() 120 | 121 | m4_popdef([b4_copyright_years]) 122 | -------------------------------------------------------------------------------- /win-util/data/xslt/bison.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 27 | 28 | 33 | 38 | 43 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | 68 | 69 | 70 | 71 | 75 | 79 | 80 | s 81 | 82 | 83 | r 84 | 85 | 86 | 87 | 88 | 89 | , 90 | 91 | 92 | 93 | 94 | 0 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /win-util/flex.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/win-util/flex.exe -------------------------------------------------------------------------------- /win-util/nasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/win-util/nasm.exe -------------------------------------------------------------------------------- /win-util/patch.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdb/panda3d-thirdparty/9d56867af908ef1350136f127e3d0f53098ada5a/win-util/patch.exe --------------------------------------------------------------------------------