| I l@ve RuBoard |
9.2 Advanced GUI Coding TechniquesIf you read Chapter 8, you know that the code used to construct non-trivial GUIs can become large if we make each widget by hand. Not only do we have to manually link up all the widgets, but there are dozens of options to be set and remember. If we stick to this strategy, GUI programming often becomes an exercise in typing, or at least in cut-and-paste text editor operations. 9.2.1 GuiMixin: Shared Behavior in "Mixin" ClassesRather than doing each step by hand, a better idea is to wrap or automate as much of the GUI construction process as possible. One approach is to code functions that provide typical widget configurations; for instance, we could define a button function to handle configuration details and support most of the buttons we draw. Alternatively, we can implement common methods in a class and inherit them everywhere they are needed. Such classes are commonly called mixin classes, because their methods are "mixed in" with other classes. Mixins serve to package generally useful tools as methods. The concept is almost like importing a module, but mixin classes can access the subject instance, self, to utilize per-instance state and inherited methods. The script in Example 9-1 shows how. Example 9-1. PP2E\Gui\Tools\guimixin.py######################################################## # a "mixin" class for other frames: common methods for # canned-dialogs, spawning programs, etc; must be mixed # with a class derived from Frame for its quit method ######################################################## from Tkinter import * from tkMessageBox import * from tkFileDialog import * from ScrolledText import ScrolledText from PP2E.launchmodes import PortableLauncher, System class GuiMixin: def infobox(self, title, text, *args): # use standard dialogs return showinfo(title, text) # *args for bkwd compat def errorbox(self, text): showerror('Error!', text) def question(self, title, text, *args): return askyesno(title, text) def notdone(self): showerror('Not implemented', 'Option not available') def quit(self): ans = self.question('Verify quit', 'Are you sure you want to quit?') if ans == 1: Frame.quit(self) # quit not recursive! def help(self): self.infobox('RTFM', 'See figure 1...') # override this better def selectOpenFile(self, file="", dir="."): # use standard dialogs return askopenfilename(initialdir=dir, initialfile=file) def selectSaveFile(self, file="", dir="."): return asksaveasfilename(initialfile=file, initialdir=dir) def clone(self): new = Toplevel( ) # make a new version of me myclass = self.__class__ # instance's (lowest) class object myclass(new) # attach/run instance to new window def spawn(self, pycmdline, wait=0): if not wait: PortableLauncher(pycmdline, pycmdline)( ) # run Python progam else: System(pycmdline, pycmdline)( ) # wait for it to exit def browser(self, filename): new = Toplevel( ) # make new window text = ScrolledText(new, height=30, width=90) # Text with scrollbar text.config(font=('courier', 10, 'normal')) # use fixed-width font text.pack( ) new.title("Text Viewer") # set window mgr attrs new.iconname("browser") text.insert('0.0', open(filename, 'r').read( ) ) # insert file's text if __name__ == '__main__': class TestMixin(GuiMixin, Frame): # stand-alone test def __init__(self, parent=None): Frame.__init__(self, parent) self.pack( ) Button(self, text='quit', command=self.quit).pack(fill=X) Button(self, text='help', command=self.help).pack(fill=X) Button(self, text='clone', command=self.clone).pack(fill=X) TestMixin().mainloop( ) Although Example 9-1 is geared towards GUIs, it's really about design concepts. The GuiMixin class implements common operations with standard interfaces that are immune to changes in implementation. In fact, the implementations of some of this class's method did change -- between the first and second editions of this book, old-style Dialog calls were replaced with the new Tk standard dialog calls. Because this class's interface hides such details, its clients did not have to be changed to use the new dialog techniques. As is, GuiMixin provides methods for common dialogs, window cloning, program spawning, text file browsing, and so on. We can add more methods to such a mixin later if we find ourselves coding the same methods repeatedly; they will all become available immediately everywhere this class is imported and mixed. Moreover, GuiMixin's methods can be inherited and used as is, or they can be redefined in subclasses. There are a few things to notice here:
The GuiMixin class is meant to be a library of reusable tool methods and is essentially useless by itself. In fact, it must generally be mixed with a Frame-based class to be used: quit assumes it's mixed with a Frame, and clone assumes it's mixed with a widget class. To satisfy such constraints this module's self-test code at the bottom combines GuiMixin with a Frame widget. Figure 9-1 shows the scene created by the self-test after pressing "clone" twice, and then "help" in one of the three copies. Figure 9-1. GuiMixin self-test code in actionWe'll see this class show up again as a mixin in later examples, too -- that's the whole point of code reuse, after all. 9.2.2 GuiMaker: Automating Menus and ToolbarsThe last section's mixin class makes common tasks simpler, but it still doesn't address the complexity of linking up widgets like menus and toolbars. Of course, if we had access to a GUI layout tool that generated Python code, this would not be an issue. We'd design our widgets interactively, press a button, and fill in the callback handler blanks. For now, a programming-based approach can work just as well. What we'd like is to be able to inherit something that does all the grunt work of construction for us, given a template for the menus and toolbars in a window. Here's one way it can be done -- using trees of simple objects. The class in Example 9-2 interprets data structure representations of menus and toolbars, and builds all the widgets automatically. Example 9-2. PP2E\Gui\Tools\guimaker.py############################################################################### # An extended Frame that makes window menus and tool-bars automatically. # Use GuiMakerFrameMenu for embedded components (makes frame-based menus). # Use GuiMakerWindowMenu for top-level windows (makes Tk8.0 window menus). # See the self-test code (and PyEdit) for an example layout tree format. ############################################################################### import sys from Tkinter import * # widget classes from types import * # type constants class GuiMaker(Frame): menuBar = [] # class defaults toolBar = [] # change per instance in subclasses helpButton = 1 # set these in start( ) if need self def __init__(self, parent=None): Frame.__init__(self, parent) self.pack(expand=YES, fill=BOTH) # make frame stretchable self.start( ) # for subclass: set menu/toolBar self.makeMenuBar( ) # done here: build menu-bar self.makeToolBar( ) # done here: build tool-bar self.makeWidgets( ) # for subclass: add middle part def makeMenuBar(self): """ make menu bar at the top (Tk8.0 menus below) expand=no, fill=x so same width on resize """ menubar = Frame(self, relief=RAISED, bd=2) menubar.pack(side=TOP, fill=X) for (name, key, items) in self.menuBar: mbutton = Menubutton(menubar, text=name, underline=key) mbutton.pack(side=LEFT) pulldown = Menu(mbutton) self.addMenuItems(pulldown, items) mbutton.config(menu=pulldown) if self.helpButton: Button(menubar, text = 'Help', cursor = 'gumby', relief = FLAT, command = self.help).pack(side=RIGHT) def addMenuItems(self, menu, items): for item in items: # scan nested items list if item == 'separator': # string: add separator menu.add_separator({}) elif type(item) == ListType: # list: disabled item list for num in item: menu.entryconfig(num, state=DISABLED) elif type(item[2]) != ListType: menu.add_command(label = item[0], # command: underline = item[1], # add command command = item[2]) # cmd=callable else: pullover = Menu(menu) self.addMenuItems(pullover, item[2]) # sublist: menu.add_cascade(label = item[0], # make submenu underline = item[1], # add cascade menu = pullover) def makeToolBar(self): """ make button bar at bottom, if any expand=no, fill=x so same width on resize """ if self.toolBar: toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) for (name, action, where) in self.toolBar: Button(toolbar, text=name, command=action).pack(where) def makeWidgets(self): """ make 'middle' part last, so menu/toolbar is always on top/bottom and clipped last; override this default, pack middle any side; for grid: grid middle part in a packed frame """ name = Label(self, width=40, height=10, relief=SUNKEN, bg='white', text = self.__class__.__name__, cursor = 'crosshair') name.pack(expand=YES, fill=BOTH, side=TOP) def help(self): """ override me in subclass """ from tkMessageBox import showinfo showinfo('Help', 'Sorry, no help for ' + self.__class__.__name__) def start(self): pass # override me in subclass ############################################################################### # For Tk 8.0 main window menubar, instead of a frame ############################################################################### GuiMakerFrameMenu = GuiMaker # use this for embedded component menus class GuiMakerWindowMenu(GuiMaker): # use this for top-level window menus def makeMenuBar(self): menubar = Menu(self.master) self.master.config(menu=menubar) for (name, key, items) in self.menuBar: pulldown = Menu(menubar) self.addMenuItems(pulldown, items) menubar.add_cascade(label=name, underline=key, menu=pulldown) if self.helpButton: if sys.platform[:3] == 'win': menubar.add_command(label='Help', command=self.help) else: pulldown = Menu(menubar) # linux needs real pulldown pulldown.add_command(label='About', command=self.help) menubar.add_cascade(label='Help', menu=pulldown) ############################################################################### # Self test when file run stand-alone: 'python guimaker.py' ############################################################################### if __name__ == '__main__': from guimixin import GuiMixin # mixin a help method menuBar = [ ('File', 0, [('Open', 0, lambda:0), # lambda:0 is a no-op ('Quit', 0, sys.exit)]), # use sys, no self here ('Edit', 0, [('Cut', 0, lambda:0), ('Paste', 0, lambda:0)]) ] toolBar = [('Quit', sys.exit, {'side': LEFT})] class TestAppFrameMenu(GuiMixin, GuiMakerFrameMenu): def start(self): self.menuBar = menuBar self.toolBar = toolBar class TestAppWindowMenu(GuiMixin, GuiMakerWindowMenu): def start(self): self.menuBar = menuBar self.toolBar = toolBar class TestAppWindowMenuBasic(GuiMakerWindowMenu): def start(self): self.menuBar = menuBar self.toolBar = toolBar # guimaker help, not guimixin root = Tk( ) TestAppFrameMenu(Toplevel( )) TestAppWindowMenu(Toplevel( )) TestAppWindowMenuBasic(root) root.mainloop( ) To make sense of this module, you have to be familiar with the menu fundamentals introduced in the last chapter. If you are, though, it's straightforward -- the GuiMaker class simply traverses the menu and toolbar structures and builds menu and toolbar widgets along the way. This module's self-test code includes a simple example of the data structures used to lay out menus and toolbars:
<IP_ADDRESS> Subclass protocolsIn addition to menu and toolbar layouts, clients of this class can also tap into and customize the method and geometry protocols it implements:
<IP_ADDRESS> GuiMaker classesIn return for conforming to GuiMaker protocols and templates, client subclasses get a Frame that knows how to automatically build up its own menus and toolbars from template data structures. If you read the last chapter's menu examples, you probably know that this is a big win in terms of reduced coding requirements. GuiMaker is also clever enough to export interfaces for both menu styles that we met in the last chapter:
Both classes build toolbars, export the same protocols, and expect to find the same template structures; they differ only in the way they process menu templates. In fact, one is simply a subclass of the other with a specialized menu maker method -- only top-level menu processing differs between the two styles (a Menu with Menu cascades, instead of a Frame with Menubuttons). <IP_ADDRESS> GuiMaker self-testLike GuiMixin, when we run Example 9-2 as a top-level program, we trigger the self-test logic at the bottom; Figure 9-2 shows the windows we get. Three windows come up, representing each of the self-test code's TestApp classes. All three have a menu and toolbar with the options specified in the template data structures created in the self-test code: File and Edit menu pull-downs, plus a Quit toolbar button, and a standard Help menu button. In the screen shot, one window's File menu has been torn off, and the Edit menu of another is being pulled down. Figure 9-2. GuiMaker self-test at workBecause of the superclass relationships coded, two of the three windows get their help callback handler from GuiMixin; TestAppWindowMenuBasic gets GuiMaker's instead. Notice that the order in which these two classes are mixed can be important: because both GuiMixin and Frame define a quit method, we need to list the class we want to get it from first in the mixed class's header line due to the left-to-right search rule of multiple inheritance. To select GuiMixin's methods, it should usually be listed before a superclass derived from real widgets. We'll put GuiMaker to more practical use in examples such as PyEdit later in this chapter. The next module shows another way to use GuiMaker's templates to build up a sophisticated interface. 9.2.3 BigGui: A Client Demo ProgramLet's look at a program that makes better use of the two automation classes we just wrote. In the module in Example 9-3, the Hello class inherits from both GuiMixin and GuiMaker. GuiMaker provides the link to the Frame widget, plus the menu/toolbar construction logic. GuiMixin provides extra common-behavior methods. Really, Hello is another kind of extended Frame widget because it is derived from GuiMaker. To get a menu and toolbar for free, it simply follows the protocols defined by GuiMaker -- it sets the menuBar and toolBar attributes in its start method, and overrides makeWidgets to put a label in the middle. Example 9-3. PP2E\Gui\Tools\BigGui\big_gui.py#!/usr/bin/python ######################################################### # gui implementation - combines maker, mixin, and this ######################################################### import sys, os, string from Tkinter import * # widget classes from PP2E.Gui.Tools.guimixin import * # mix-in methods from PP2E.Gui.Tools.guimaker import * # frame, plus menu/toolbar builder from find_demo_dir import findDemoDir # Python demos search class Hello(GuiMixin, GuiMakerWindowMenu): # or GuiMakerFrameMenu def start(self): self.hellos = 0 self.master.title("GuiMaker Demo") self.master.iconname("GuiMaker") self.menuBar = [ # a tree: 3 pulldowns ('File', 0, # (pull-down) [('New...', 0, self.notdone), # [menu items list] ('Open...', 0, self.fileOpen), ('Quit', 0, self.quit)] # label,underline,action ), ('Edit', 0, [('Cut', -1, self.notdone), # no underline|action ('Paste',-1, self.notdone), # lambda:0 works too 'separator', # add a separator ('Stuff', -1, [('Clone', -1, self.clone), # cascaded submenu ('More', -1, self.more)] ), ('Delete', -1, lambda:0), [5]] # disable 'delete' ), ('Play', 0, [('Hello', 0, self.greeting), ('Popup...', 0, self.dialog), ('Demos', 0, [('Hanoi', 0, lambda x=self: x.spawn(findDemoDir( ) + '\guido\hanoi.py', wait=0)), ('Pong', 0, lambda x=self: x.spawn(findDemoDir( ) + '\matt\pong-demo-1.py', wait=0)), ('Other...', -1, self.pickDemo)] )] )] self.toolBar = [ ('Quit', self.quit, {'side': RIGHT}), # add 3 buttons ('Hello', self.greeting, {'side': LEFT}), ('Popup', self.dialog, {'side': LEFT, 'expand':YES}) ] def makeWidgets(self): # override default middle = Label(self, text='Hello maker world!', width=40, height=10, cursor='pencil', bg='white', relief=SUNKEN) middle.pack(expand=YES, fill=BOTH) def greeting(self): self.hellos = self.hellos + 1 if self.hellos % 3: print "hi" else: self.infobox("Three", 'HELLO!') # on every third press def dialog(self): button = self.question('OOPS!', 'You typed "rm*" ... continue?', 'questhead', ('yes', 'no', 'help')) [lambda:0, self.quit, self.help][button]( ) def fileOpen(self): pick = self.selectOpenFile(file='big_gui.py') if pick: self.browser(pick) # browse my source file, or other def more(self): new = Toplevel( ) Label(new, text='A new non-modal window').pack( ) Button(new, text='Quit', command=self.quit).pack(side=LEFT) Button(new, text='More', command=self.more).pack(side=RIGHT) def pickDemo(self): pick = self.selectOpenFile(dir=findDemoDir( )+'\guido') if pick: self.spawn(pick, wait=0) # spawn any python program if __name__ == '__main__': Hello().mainloop( ) # make one, run one This script lays out a fairly large menu and toolbar structure that we'll see in moment. It also adds callback methods of its own that print stdout messages, pop up text file browsers and new windows, and run other programs. Many of the callbacks don't do much more than run the notDone method inherited from GuiMixin, though; this code is intended mostly as a GuiMaker and GuiMixin demo. The big_gui script is almost a complete program, but not quite: it relies on a utility module to search for canned demo programs that come packaged with the Python full source distribution. (These demos are not part of this book's example collection.) The Python source distribution might be unpacked anywhere on the host machine. Because of that, it's impossible to know where the demo directory is located (if it is present at all). But rather than expecting beginners to change the source code of this script to hardcode a path, the guessLocation tool in the Launcher module we met at the end of Chapter 4 is used to hunt for the demo directory (see Example 9-4). Flip back if you've forgotten how this works (though the beauty of code reuse is that it's often okay to forget). Example 9-4. PP2E\Gui\Tools\BigGui\find_demo_dir.py######################################################### # search for demos shipped in Python source distribution; # PATH and PP2EHOME won't help here, because these demos # are not part of the standard install or the book's tree ######################################################### import os, string, PP2E.Launcher demoDir = None myTryDir = '' #sourceDir = r'C:\Stuff\Etc\Python-ddj-cd\distributions' #myTryDir = sourceDir + r'\Python-1.5.2\Demo\tkinter' def findDemoDir( ): global demoDir if not demoDir: # only searches on first call if os.path.exists(myTryDir): # use hard-coded dir, or search demoDir = myTryDir # save in global for next call else: print 'Searching for standard demos on your machine...' path = PP2E.Launcher.guessLocation('hanoi.py') if path: demoDir = string.join(string.split(path, os.sep)[:-2], os.sep) print 'Using demo dir:', demoDir assert demoDir, 'Where is your demo directory?' return demoDir When big_gui is run as a top-level program, it creates a window with four menu pull-downs on top, and a three-button toolbar on the bottom, shown in Figure 9-3 along with some of the pop-up windows its callbacks create. The menus have separators, disabled entries, and cascading submenus, all as defined by the menuBar template. Figure 9-3. big_gui with various pop-upsFigure 9-4 shows this script's window again, after its Play pull-down has been used to launch two independently running instances of the hanoi.py demo script that is shipped in the Python source distribution and coded by Python creator Guido van Rossum. This demo shows a simple animation of solutions to the "Towers of Hanoi" puzzle -- a classic recursive problem popular on computer science quizzes (if you never heard of it, I'll spare you the gory details here). Figure 9-4. big_gui with spawned hanoi demos on the moveTo find this demo, the script searches directory trees on your machine rooted at common places; it was found on mine only by a last-resort traversal of my entire C: hard drive: C:\...\PP2E\Gui\Tools\BigGui>python big_gui.py Searching for standard demos on your machine... Searching for hanoi.py in C:\Program Files\Python Searching for hanoi.py in C:\PP2ndEd\examples\PP2E\Gui\Tools\BigGui Searching for hanoi.py in C:\Program Files Searching for hanoi.py in C:\ Using demo dir: C:\PP2ndEd\cdrom\Python1.5.2\SourceDistribution\Unpacked\Python- 1.5.2\Demo\tkinter C:\PP2ndEd\cdrom\Python1.5.2\SourceDistribution\Unpacked\Python-1.5.2\Demo\tkint er\guido\hanoi.py This search takes about 20 seconds on my 650 MHz Windows laptop, but is done only the first time you select one of these demos -- after a successful search, the find_demo_dir module caches away the directory name in a global variable for immediate retrieval the next time you start a demo. If you want to run demos from other directories (e.g., one of the book demos in the PP2E tree), select the Play menu's Other option to pop up a standard file selection dialog instead and navigate to the desired program's file. Finally, I should note that GuiMaker can be redesigned to use trees of embedded class instances that know how to apply themselves to the Tkinter widget tree being constructed, instead of branching on the types of items in template data structures. In the interest of space, though, we'll banish that extension to the land of suggested exercises in this edition. 9.2.4 ShellGui: Adding GUIs to Command-Line ToolsTo better show how things like the GuiMixin class can be of practical use, we need a more realistic application. Here's one: in Chapter 4, we saw simple scripts for packing and unpacking text files (see Section 4.5). The packapp.py script we met there, you'll recall, concatenates multiple text files into a single file, and unpackapp.py extracts the original files from the combined file. We ran these scripts in that chapter with manually typed command lines that weren't the most complex ever devised, but were complicated enough to be easily forgotten. Rather than requiring users of such tools to type cryptic commands at a shell, why not also provide an easy-to-use Tkinter GUI interface for running such programs? While we're at it, why not generalize the whole notion of running command-line tools from a GUI, to make it easy to support future tools, too? <IP_ADDRESS> A generic shell-tools displayExamples Example 9-5 through Example 9-8 are one concrete implementation of these artificially rhetorical musings. Because I wanted this to be a general-purpose tool that could run any command-line program, its design is factored into modules that become more application-specific as we go lower in the software hierarchy. At the top, things are about as generic as they can be, as shown in Example 9-5. Example 9-5. PP2E\Gui\ShellGui\shellgui.py.py#!/usr/local/bin/python ##################################################################### # tools launcher; uses guimaker templates, guimixin std quit dialog; # I am just a class library: run mytools script to display the gui; ##################################################################### from Tkinter import * # get widgets from PP2E.Gui.Tools.guimixin import GuiMixin # get quit, not done from PP2E.Gui.Tools.guimaker import * # menu/toolbar builder class ShellGui(GuiMixin, GuiMakerWindowMenu): # a frame + maker + mixins def start(self): # use GuiMaker if component self.setMenuBar( ) self.setToolBar( ) self.master.title("Shell Tools Listbox") self.master.iconname("Shell Tools") def handleList(self, event): # on listbox double-click label = self.listbox.get(ACTIVE) # fetch selection text self.runCommand(label) # and call action here def makeWidgets(self): # add listbox in middle sbar = Scrollbar(self) # cross link sbar, list list = Listbox(self, bg='white') # or use Tour.ScrolledList sbar.config(command=list.yview) list.config(yscrollcommand=sbar.set) sbar.pack(side=RIGHT, fill=Y) # pack 1st=clip last list.pack(side=LEFT, expand=YES, fill=BOTH) # list clipped first for (label, action) in self.fetchCommands( ): # add to list-box list.insert(END, label) # and menu/toolbars list.bind('<Double-1>', self.handleList) # set event handler self.listbox = list def forToolBar(self, label): # put on toolbar? return 1 # default = all def setToolBar(self): self.toolBar = [] for (label, action) in self.fetchCommands( ): if self.forToolBar(label): self.toolBar.append((label, action, {'side': LEFT})) self.toolBar.append(('Quit', self.quit, {'side': RIGHT})) def setMenuBar(self): toolEntries = [] self.menuBar = [ ('File', 0, [('Quit', -1, self.quit)]), # pull-down name ('Tools', 0, toolEntries) # menu items list ] # label,underline,action for (label, action) in self.fetchCommands( ): toolEntries.append((label, -1, action)) # add app items to menu ################################################### # delegate to template type-specific subclasses # which delegate to app toolset-specific subclasses ################################################### class ListMenuGui(ShellGui): def fetchCommands(self): # subclass: set 'myMenu' return self.myMenu # list of (label, callback) def runCommand(self, cmd): for (label, action) in self.myMenu: if label == cmd: action( ) class DictMenuGui(ShellGui): def fetchCommands(self): return self.myMenu.items( ) def runCommand(self, cmd): self.myMenu[cmd]( ) The ShellGui class in this module knows how to use the GuiMaker and GuiMix interfaces to construct a selection window that displays tool names in menus, a scrolled list, and a toolbar. It also provides an overridable forToolBar method that allows subclasses to specify which tools should and should not be added to the window's toolbar (the toolbar can get crowded in a hurry). However, it is deliberately ignorant about both the names of tools that should be displayed in those places, and the actions to be run when tool names are selected. Instead, ShellGui relies on the ListMenuGui and DictMenuGui subclasses in this file to provide a list of tool names from a fetchCommands method and dispatch actions by name in a runCommand method. These two subclasses really just serve to interface to application-specific tool sets laid out as lists or dictionaries, though; they are still naive about what tool names really go up on the GUI. That's by design, too -- because the tool sets displayed are defined by lower subclasses, we can use ShellGui to display a variety of different tool sets. <IP_ADDRESS> Application-specific tool set classesTo get to the actual tool sets, we need to go one level down. The module in Example 9-6 defines subclasses of the two type-specific ShellGui classes, to provide sets of available tools in both list and dictionary format (you would normally need only one, but this module is meant for illustration). This is also the module that is actually run to kick off the GUI -- the shellgui module is a class library only. Example 9-6. PP2E\Gui\ShellGui\mytools.py#!/usr/local/bin/python from shellgui import * # type-specific shell interfaces from packdlg import runPackDialog # dialogs for data entry from unpkdlg import runUnpackDialog # they both run app classes class TextPak1(ListMenuGui): def __init__(self): self.myMenu = [('Pack', runPackDialog), ('Unpack', runUnpackDialog), # simple functions ('Mtool', self.notdone)] # method from guimixin ListMenuGui.__init__(self) def forToolBar(self, label): return label in ['Pack', 'Unpack'] class TextPak2(DictMenuGui): def __init__(self): self.myMenu = {'Pack': runPackDialog, # or use input here... 'Unpack': runUnpackDialog, # instead of in dialogs 'Mtool': self.notdone} DictMenuGui.__init__(self) if __name__ == '__main__': # self-test code... from sys import argv # 'menugui.py list|^' if len(argv) > 1 and argv[1] == 'list': print 'list test' TextPak1().mainloop( ) else: print 'dict test' TextPak2().mainloop( ) The classes in this module are specific to a particular tools set; to display a different set of tool names, simply code and run a new subclass. By separating out application logic into distinct subclasses and modules like this, software can become widely reusable. Figure 9-5 shows the main ShellGui window created when the mytools script is run with its dictionary-based menu layout class on Windows, along with menu tear-offs so you can see what they contain. This window's menu and toolbar are built by GuiMaker, and its Quit and Help buttons and menu selections trigger quit and help methods inherited from GuiMixin through the ShellGui module's superclasses. Are you starting to see why this book preaches code reuse so often? Figure 9-5. mytools items in a ShellGui window<IP_ADDRESS> Adding GUI frontends to command linesThe callback actions named within the prior module's classes, though, should normally do something GUI-oriented. Because the original file packing and unpacking scripts live in the world of text-based streams, we need to code wrappers around them that accept input parameters from more GUI-minded users. The module in Example 9-7 uses the custom modal dialog techniques we studied in Chapter 7, to pop up an input display to collect pack script parameters. Its runPackDialog function is the actual callback handler invoked when tool names are selected in the main ShellGui window. Example 9-7. PP2E\Gui\ShellGui\packdlg.py.# added file select dialogs, empties test; could use grids import string from glob import glob # filename expansion from Tkinter import * # gui widget stuff from tkFileDialog import * # file selector dialog from PP2E.System.App.Clients.packapp import PackApp # use pack class def runPackDialog( ): s1, s2 = StringVar(), StringVar( ) # run class like a function PackDialog(s1, s2) # pop-up dialog: sets s1/s2 output, patterns = s1.get(), s2.get( ) # whether 'ok' or wm-destroy if output != "" and patterns != "": patterns = string.split(patterns) filenames = [] for sublist in map(glob, patterns): # do expansion manually filenames = filenames + sublist # Unix does auto on command-line print 'PackApp:', output, filenames app = PackApp(ofile=output) # run with redirected output app.args = filenames # reset cmdline args list app.main( ) # should show msgs in gui too class PackDialog(Toplevel): def __init__(self, target1, target2): Toplevel.__init__(self) # a new top-level window self.title('Enter Pack Parameters') # 2 frames plus a button f1 = Frame(self) l1 = Label(f1, text='Output file?', relief=RIDGE, width=15) e1 = Entry(f1, relief=SUNKEN) b1 = Button(f1, text='browse...') f1.pack(fill=X) l1.pack(side=LEFT) e1.pack(side=LEFT, expand=YES, fill=X) b1.pack(side=RIGHT) b1.config(command= (lambda x=target1: x.set(askopenfilename( ))) ) f2 = Frame(self) l2 = Label(f2, text='Files to pack?', relief=RIDGE, width=15) e2 = Entry(f2, relief=SUNKEN) b2 = Button(f2, text='browse...') f2.pack(fill=X) l2.pack(side=LEFT) e2.pack(side=LEFT, expand=YES, fill=X) b2.pack(side=RIGHT) b2.config(command= (lambda x=target2: x.set(x.get() +' '+ askopenfilename( ))) ) Button(self, text='OK', command=self.destroy).pack( ) e1.config(textvariable=target1) e2.config(textvariable=target2) self.grab_set( ) # make myself modal: self.focus_set( ) # mouse grab, keyboard focus, wait... self.wait_window( ) # till destroy; else returns to caller now if __name__ == '__main__': root = Tk( ) Button(root, text='pop', command=runPackDialog).pack(fill=X) Button(root, text='bye', command=root.quit).pack(fill=X) root.mainloop( ) When run, this script makes the input form shown in Figure 9-6. Users may either type input and output filenames into the entry fields, or press the "browse..." buttons to pop up standard file selection dialogs. They can also enter filename patterns -- the manual glob.glob call in this script expands filename patterns to match names and filters out nonexistent input filenames. The Unix command line does this pattern expansion automatically when running PackApp from a shell, but Windows does not (see Chapter 2, for more details). Figure 9-6. The packdlg input formWhen the form is filled in and submitted with its OK button, parameters are finally passed to an instance of the PackApp class we wrote in Chapter 4 to do file concatenations. The GUI interface to the unpacking script is simpler, because there is only one input field -- the name of the packed file to scan. The script in Example 9-8 generated the input form window shown in Figure 9-7. Example 9-8. PP2E\Gui\ShellGui\unpkdlg.py# added file select dialog, handles cancel better from Tkinter import * # widget classes from tkFileDialog import * # file open dialog from PP2E.System.App.Clients.unpackapp import UnpackApp # use unpack class def runUnpackDialog( ): input = UnpackDialog( ).input # get input from GUI if input != '': # do non-gui file stuff print 'UnpackApp:', input app = UnpackApp(ifile=input) # run with input from file app.main( ) # execute app class class UnpackDialog(Toplevel): def __init__(self): # a function would work too Toplevel.__init__(self) # resizable root box self.input = '' # a label and an entry self.title('Enter Unpack Parameters') Label(self, text='input file?', relief=RIDGE, width=11).pack(side=LEFT) e = Entry(self, relief=SUNKEN) b = Button(self, text='browse...') e.bind('<Key-Return>', self.gotit) b.config(command=(lambda x=e: x.insert(0, askopenfilename( )))) b.pack(side=RIGHT) e.pack(side=LEFT, expand=YES, fill=X) self.entry = e self.grab_set( ) # make myself modal self.focus_set( ) self.wait_window( ) # till I'm destroyed on return->gotit def gotit(self, event): # on return key: event.widget==Entry self.input = self.entry.get( ) # fetch text, save in self self.destroy( ) # kill window, but instance lives on if __name__ == "__main__": Button(None, text='pop', command=runUnpackDialog).pack( ) mainloop( ) The "browse..." button in Figure 9-7 pops up a file selection dialog just like the packdlg form. Rather than an OK button, this dialog binds the enter key-press event to kill the window and end the modal wait state pause; on submission, the name of the file is passed to an instance of the UnpackApp class shown in Chapter 4 to perform the actual file scan process. Figure 9-7. The unpkdlg input formThis all works as advertised -- by making command-line tools available in graphical form like this, they become much more attractive to users accustomed to the GUI way of life. Still, there are two aspects of this design that seem prime for improvement. First of all, both of the input dialogs use custom code to render a unique appearance, but we could probably simplify them substantially by importing a common form-builder module instead. We met generalized form builder code in Chapter 7 and Chapter 8, and we'll meet more later; see the form.py module in Chapter 10, for pointers on genericizing form construction, too. Secondly, at the point where the user submits input data in either form dialog, we've lost the GUI trail -- PackApp and UnpackApp messages still show up in the stdout console window: C:\...\PP2E\Gui\ShellGui\test>python ..\mytools.py dict test PackApp: packed.all ['spam.txt', 'eggs.txt', 'ham.txt'] packing: spam.txt packing: eggs.txt packing: ham.txt UnpackApp: packed.all creating: spam.txt creating: eggs.txt creating: ham.txt We can do better here, by redirecting stdout to an object that throws text up in a GUI window as it is received. You'll have to read the next section to see how. 9.2.5 GuiStreams: Redirecting Streams to GUI WidgetsThe script in Example 9-9 arranges to map input and output sources to pop-up windows in a GUI application, much as we did with strings in the stream redirection topics in Chapter 2. Although this module is really just a first-cut prototype and needs improvement itself (e.g., each input line request pops up a new input dialog), it demonstrates the concepts in general. Its GuiOutput and GuiInput objects define methods that allow them to masquerade as files in any interface that expects a file. As we learned earlier in Chapter 2, this includes standard stream processing tools like print, raw_input, and explicit read and write calls. The redirectedGuiFunc function in this module uses this plug-and-play compatibility to run a function with its standard input and output streams mapped completely to pop-up windows instead of the console window (or wherever streams would otherwise be mapped). Example 9-9. PP2E\Gui\Tools\guiStreams.py############################################################################## # first-cut implementation of file-like classes that can be used to redirect # input and output streams to GUI displays; as is, input comes from a common # dialog popup (a single output+input interface or a persistent Entry field # for input would be better); this also does not properly span lines for read # requests with a byte count > len(line); see guiStreamsTools.py for more; ############################################################################## from Tkinter import * from ScrolledText import ScrolledText from tkSimpleDialog import askstring class GuiOutput: def __init__(self, parent=None): self.text = None if parent: self.popupnow(parent) # popup now or on first write def popupnow(self, parent=None): # in parent now, Toplevel later if self.text: return self.text = ScrolledText(parent or Toplevel( )) self.text.config(font=('courier', 9, 'normal')) self.text.pack( ) def write(self, text): self.popupnow( ) self.text.insert(END, str(text)) self.text.see(END) self.text.update( ) def writelines(self, lines): # lines already have '\n' for line in lines: self.write(line) # or map(self.write, lines) class GuiInput: def __init__(self): self.buff = '' def inputLine(self): line = askstring('GuiInput', 'Enter input line + <crlf> (cancel=eof)') if line == None: return '' # popup dialog for each line else: # cancel button means eof return line + '\n' # else add end-line marker def read(self, bytes=None): if not self.buff: self.buff = self.inputLine( ) if bytes: # read by byte count text = self.buff[:bytes] # doesn't span lines self.buff = self.buff[bytes:] else: text = '' # read all till eof line = self.buff while line: text = text + line line = self.inputLine( ) # until cancel=eof='' return text def readline(self): text = self.buff or self.inputLine( ) # emulate file read methods self.buff = '' return text def readlines(self): lines = [] # read all lines while 1: next = self.readline( ) if not next: break lines.append(next) return lines def redirectedGuiFunc(func, *pargs, **kargs): import sys saveStreams = sys.stdin, sys.stdout # map func streams to popups sys.stdin = GuiInput( ) # pops up dialog as needed sys.stdout = GuiOutput( ) # new output window per call sys.stderr = sys.stdout result = apply(func, pargs, kargs) # this is a blocking func call sys.stdin, sys.stdout = saveStreams return result def redirectedGuiShellCmd(command): import os input = os.popen(command, 'r') output = GuiOutput( ) def reader(input, output): # show a shell command's while 1: # standard output in a new line = input.readline( ) # popup text box widget if not line: break output.write(line) reader(input, output) if __name__ == '__main__': import string def makeUpper( ): # use standard streams while 1: try: line = raw_input('Line? ') except: break print string.upper(line) print 'end of file' def makeLower(input, output): # use explicit files while 1: line = input.readline( ) if not line: break output.write(string.lower(line)) print 'end of file' root = Tk( ) Button(root, text='test streams', command=lambda: redirectedGuiFunc(makeUpper)).pack(fill=X) Button(root, text='test files ', command=lambda: makeLower(GuiInput(), GuiOutput( )) ).pack(fill=X) Button(root, text='test popen ', command=lambda: redirectedGuiShellCmd('dir *')).pack(fill=X) root.mainloop( ) As coded here, GuiOutput either attaches a ScrolledText to a parent container, or pops up a new top-level window to serve as the container on the first write call. GuiInput pops up a new standard input dialog every time a read request requires a new line of input. Neither one of these policies is ideal for all scenarios (input would be better mapped to a more long-lived widget), but they prove the general point. Figure 9-8 shows the scene generated by this script's self-test code, after capturing the output of a shell dir listing command (on the left), and two interactive loop tests (the one with "Line?" prompts and uppercase letters represents the makeUpper streams test). An input dialog has just popped up for a new makeLower files test. Figure 9-8. guiStreams routing streams to pop-up windows<IP_ADDRESS> Using redirection for the packing scriptsNow, to use such redirection tools to map command-line script output back to a GUI, simply run calls and command lines with the two redirected functions in this module. Example 9-10 shows one way to wrap the packing operation to force its printed output to appear in a pop-up window when generated, instead of the console. Example 9-10. PP2E\Gui\ShellGui\packdlg-redirect.py# wrap command-line script in GUI redirection tool to popup its output from Tkinter import * from packdlg import runPackDialog from PP2E.Gui.Tools.guiStreams import redirectedGuiFunc def runPackDialog_Wrapped( ): redirectedGuiFunc(runPackDialog) # wrap entire callback handler if __name__ == '__main__': root = Tk( ) Button(root, text='pop', command=runPackDialog_Wrapped).pack(fill=X) root.mainloop( ) You can run this script directly to test its effect, without bringing up the ShellGui window. Figure 9-9 shows the resulting stdout window after the pack input dialog is dismissed. This window pops up as soon as script output is generated, and is a bit more GUI user-friendly than hunting for messages in a console. You can similarly code the unpack parameters dialog to route its output to a pop-up too.[2] In fact, you can use this technique to route the output of any function call or command line to a pop-up window; as usual, the notion of compatible object interfaces are at the heart of much of Python's flexibility.
Figure 9-9. Routing script outputs to GUI pop-ups9.2.6 Reloading GUI Callback Handlers DynamicallyOne last GUI programming technique merits a quick look here. The Python reload function lets you dynamically change and reload a program's modules without stopping the program. For instance, you can bring up a text editor window to change the source code of selected parts of a system while it is running and see those changes show up immediately after reloading the changed module. This is a powerful feature, especially for developing programs that take a long time to restart. Programs that connect to databases or network servers, initialize large objects, or travel through a long series of steps to retrigger a callback are prime candidates for reload. It can shave substantial time from the development cycle. The catch for GUIs, though, is that because callback handlers are registered as object references instead of module and object names, reloads of callback handler functions are ineffective after the callback has been registered. The Python reload operation works by changing a module object's contents in place. Because Tkinter stores a pointer to the registered handler object directly, though, it is oblivious to any reloads of the module that the handler came from. That is, Tkinter will still reference a module's old objects even after the module is reloaded and changed. This is a subtle thing, but you really only need to remember that you must do something special to reload callback handler functions dynamically. Not only do you need to explicitly request reloading of the modules that you change, but you must also generally provide an indirection layer that routes callbacks from registered objects to modules, so that reloads have impact. For example, the script in Example 9-11 goes the extra mile to indirectly dispatch callbacks to functions in an explicitly reloaded module. The callback handlers registered with Tkinter are method objects that do nothing but reload and dispatch again. Because the true callback handler functions are fetched through a module object, reloading that module makes the latest versions of the functions accessible. Example 9-11. PP2E\Gui\Tools\Reload\rad.pyfrom Tkinter import * import actions # get initial callback handlers class Hello(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.pack( ) self.make_widgets( ) def make_widgets(self): Button(self, text='message1', command=self.message1).pack(side=LEFT) Button(self, text='message2', command=self.message2).pack(side=RIGHT) def message1(self): reload(actions) # need to reload actions module before calling actions.message1( ) # now new version triggered by pressing button def message2(self): reload(actions) # changes to actions.py picked up by reload actions.message2(self) # call the most recent version; pass self def method1(self): print 'exposed method...' # called from actions function Hello().mainloop( ) When run, this script makes a two-button window that triggers the message1 and message2 methods. Example 9-12 contains the actual callback handlers' code. Its functions receive a self argument that gives access back to the Hello class object, as though these were real methods. You can change this file any number of times while the rad script's GUI is active; each time you do so, you'll change the behavior of the GUI when a button press occurs. Example 9-12. PP2E\Gui\Tools\Reload\actions.py# callback handlers: reloaded each time triggered def message1( ): # change me print 'spamSpamSPAM' # could build a dialog... def message2(self): print 'Ni! Ni!' # change me self.method1( ) # access the 'Hello' instance... Try running rad and editing the messages printed by actions in another window; you should see your new messages printed in the stdout console window each time the GUI's buttons are pressed. This example is deliberately simple to illustrate the concept, but the actions reloaded like this in practice might build pop-up dialogs, new top-level windows, and so on. Reloading the code that creates such windows would also let us dynamically change their appearances. There are other ways to change a GUI while it's running. For instance, we saw in Chapter 8 that appearances can be altered at any time by calling the widget config method, and widgets can be added and deleted from a display dynamically with methods like pack_forget and pack (and their grid manager relatives). Furthermore, passing a new command=action option setting to a widget's config method might reset a callback handler to a new action object on the fly; with enough support code, this may be a viable alternative to the indirection scheme used above to make reloads more effective in GUIs. |
| I l@ve RuBoard |


Home
Order A Sample
Order A Sample
Please fill out the details below to order a sample
Product Id
*
:
Item Color :
Email
*
:
Country
*
:
Select Country
City
*
:
Select city
Phone
*
:
ASI Number
*
:
Product Name
*
:
Contact Name
*
:
Street Address
*
:
State
*
:
Select State
Zip code
*
:
Company
*
:
FEDEX / UPS Acct #:(for sample requests only)
*
Comments:
Enter captcha code.
*
Type the above number:
Refresh
* Required Fields


- Name
- {{ contact.name }}
- Code
- {{ contact.code }}
- Type
- {{ contact.type }}
- Contact Type
- {{ contact.contactType }}
- Mailing Name
- {{ contact.mailingName }}
- Salutation
- {{ contact.salutation }}
- TAN
- {{ contact.tan }}
- PAN
- {{ contact.pan }}
- TIN
- {{ contact.tin }}
- Service Tax Number
- {{ contact.serviceTaxNumber }}
- Assigned To Partner
- {{ contact.assignedToPartner }}
- Assigned To Manager
- {{ contact.assignedToManager }}
- Assigned To Entities
- {{ contact.assignedToEntities }}
- Assigned To Branch Location
- {{ contact.assignedToBranchLocation }}
- Postal Address Addressee
- {{ contact.postalAddressAddressee }}
- Postal Address Address
- {{ contact.postalAddressAddress }}
- Postal Address City
- {{ contact.postalAddressCity }}
- Postal Address State
- {{ contact.postalAddressState }}
- Postal Address Postcode
- {{ contact.postalAddressPostcode }}
- Postal Address Country
- {{ contact.postalAddressCountry }}
- Communications Work Phone
- {{ contact.communicationsWorkPhone }}
- Communications Mobile
- {{ contact.communicationsMobile }}
- Communications Skype
- {{ contact.communicationsSkype }}
- Communications Home Phone
- {{ contact.communicationsHomePhone }}
- Communications Fax
- {{ contact.communicationsFax }}
- Communications Twitter
- {{ contact.communicationsTwitter }}
- Communications Email
- {{ contact.communicationsEmail }}
- Communications Linkedin
- {{ contact.communicationsLinkedin }}
- Communications Website
- {{ contact.communicationsWebsite }}
- Contact Tax Year End
- {{ contact.contactTaxYearEnd }}
- Contact Client Type
- {{ contact.contactClientType }}
- Contact Client Type Subcategory
- {{ contact.contactClientTypeSubcategory }}
- Noof Employees
- {{ contact.noofEmployees }}
- In Business Since
- {{ contact.inBusinessSince }}
- Annual Accounts Scheduling
- {{ contact.annualAccountsScheduling }}
- Client History From
- {{ contact.clientHistoryFrom }}
- Client History Until
- {{ contact.clientHistoryUntil }}


Engineer, Entrepreneur, Trouble-Maker, Web Developer and aspiring mayor of Kathmandu.
This is Shahi Nabin.
Building startups and teams, currently based in Kyoto, Japan via Baneshwor, Kathmandu Nepal. I'm graduated from Tribhuvan University in Electrical Engineering and currently doing masters in KCGI.
Intrigued by design, traveling, photography, classical music, strategy, writing, art, fabulous food, and even better conversations.
Seeking to be inspired, to envision the unlikely, to work hard for things that are worth it, and to be surrounded by those who bring out the best in me.
Say hi on Facebook @EveBin


Browser: Chrome/16.0.912.77
My BBLog Addon Version is: 1.2
If you have already earned a medal, instead of displaying something like "45/50" on mouseover there is just " / " on an otherwise empty line. It'd be nice if this could be eliminated or fixed so something like "245/300" could be shown. Thanks (:
BrainFooLong
Administrator
This i not a bug from me :-)
This mistake produced Battlelog. So hopefully Battlelog remove this bug.
Otherwise i must integrate a bugfix in the next update.


Copy
Move
Delete
Create folder
Refresh
Create
Cancel
- choose a remote -
Items:
-
..
Completed transfers (
0
)
Started at
Status
Name
Size
-
-
-
-


|
Latest news
Updated 1:23 AM CST
Dusty -- at last
Dusty Baker has been known for the toothpicks that dangle from his mouth, the wristbands he wears on his arms and his ability to meld the frostiest of personalities.
12 Israelis Die in Hebron Ambush
Jewish worshippers walking out of a shrine in the West Bank city of Hebron were caught in a hail of bullets fired by Palestinian militants -- an ambush that killed 12 Israelis and wounded 15.
Allied Jets Retaliate For Iraqi Fire
In an action U.S. officials consider a violation of a U.N. Security Council resolution, Iraq fired surface-to-air missiles and anti-aircraft guns at American and British warplanes patrolling a "no-fly" zone.
Rolando Cruz seeks pardon
Rolando Cruz asked the state to recognize his innocence by giving him a formal pardon for the 1983 murder of 10-year-old Jeanine Nicarico, but her parents tearfully opposed clemency today.
Other top headlines:
Senior al-Qaida Leader in Custody
Blix: Inspections to Resume Nov. 27
Two charged with bilking investors
Accused priest turns self in
Man subdued in school with gas, gun
NW Side woman, 51, missing
Kan. brothers' death sentence stands
Miss America's chastity campaign riles pageant
Maryland garage collapse kills two
Midwest mystery: 4 adults in 20s missing
>> More news: Local | Nation/World
|
|
| |
Search Chicago's freshest jobs
|
|
|
|


| Package | Description |
|---|---|
| java.applet |
Provides the classes necessary to create an applet and the classes an applet
uses to communicate with its applet context.
|
| java.awt |
Contains all of the classes for creating user
interfaces and for painting graphics and images.
|
| java.awt.dnd |
Drag and Drop is a direct manipulation gesture found in many Graphical
User Interface systems that provides a mechanism to transfer
information between two entities logically associated with presentation
elements in the GUI.
|
| java.awt.print |
Provides classes and interfaces for a general printing API.
|
| javax.print |
Provides the principal classes and interfaces for the
JavaTM Print Service API.
|
| javax.swing |
Provides a set of "lightweight"
(all-Java language) components that,
to the maximum degree possible, work the same on all platforms.
|
| Constructor and Description |
|---|
Applet()
Constructs a new Applet.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
Toolkit.areExtraMouseButtonsEnabled()
Reports whether events from extra mouse buttons are allowed to be processed and posted into
EventQueue . |
protected abstract java.awt.peer.ButtonPeer |
Toolkit.createButton(Button target)
Creates this toolkit's implementation of
Button using
the specified peer interface. |
protected abstract java.awt.peer.CheckboxPeer |
Toolkit.createCheckbox(Checkbox target)
Creates this toolkit's implementation of
Checkbox using
the specified peer interface. |
protected abstract java.awt.peer.CheckboxMenuItemPeer |
Toolkit.createCheckboxMenuItem(CheckboxMenuItem target)
Creates this toolkit's implementation of
CheckboxMenuItem using
the specified peer interface. |
protected abstract java.awt.peer.ChoicePeer |
Toolkit.createChoice(Choice target)
Creates this toolkit's implementation of
Choice using
the specified peer interface. |
Cursor |
Toolkit.createCustomCursor(Image cursor,
Point hotSpot,
String name)
Creates a new custom cursor object.
|
protected abstract java.awt.peer.DesktopPeer |
Toolkit.createDesktopPeer(Desktop target)
Creates this toolkit's implementation of the
Desktop
using the specified peer interface. |
protected abstract java.awt.peer.DialogPeer |
Toolkit.createDialog(Dialog target)
Creates this toolkit's implementation of
Dialog using
the specified peer interface. |
protected abstract java.awt.peer.FileDialogPeer |
Toolkit.createFileDialog(FileDialog target)
Creates this toolkit's implementation of
FileDialog using
the specified peer interface. |
protected abstract java.awt.peer.FramePeer |
Toolkit.createFrame(Frame target)
Creates this toolkit's implementation of
Frame using
the specified peer interface. |
protected abstract java.awt.peer.LabelPeer |
Toolkit.createLabel(Label target)
Creates this toolkit's implementation of
Label using
the specified peer interface. |
protected abstract java.awt.peer.ListPeer |
Toolkit.createList(List target)
Creates this toolkit's implementation of
List using
the specified peer interface. |
protected abstract java.awt.peer.MenuPeer |
Toolkit.createMenu(Menu target)
Creates this toolkit's implementation of
Menu using
the specified peer interface. |
protected abstract java.awt.peer.MenuBarPeer |
Toolkit.createMenuBar(MenuBar target)
Creates this toolkit's implementation of
MenuBar using
the specified peer interface. |
protected abstract java.awt.peer.MenuItemPeer |
Toolkit.createMenuItem(MenuItem target)
Creates this toolkit's implementation of
MenuItem using
the specified peer interface. |
protected abstract java.awt.peer.PopupMenuPeer |
Toolkit.createPopupMenu(PopupMenu target)
Creates this toolkit's implementation of
PopupMenu using
the specified peer interface. |
protected abstract java.awt.peer.ScrollbarPeer |
Toolkit.createScrollbar(Scrollbar target)
Creates this toolkit's implementation of
Scrollbar using
the specified peer interface. |
protected abstract java.awt.peer.ScrollPanePeer |
Toolkit.createScrollPane(ScrollPane target)
Creates this toolkit's implementation of
ScrollPane using
the specified peer interface. |
protected abstract java.awt.peer.TextAreaPeer |
Toolkit.createTextArea(TextArea target)
Creates this toolkit's implementation of
TextArea using
the specified peer interface. |
protected abstract java.awt.peer.TextFieldPeer |
Toolkit.createTextField(TextField target)
Creates this toolkit's implementation of
TextField using
the specified peer interface. |
protected abstract java.awt.peer.WindowPeer |
Toolkit.createWindow(Window target)
Creates this toolkit's implementation of
Window using
the specified peer interface. |
Dimension |
Toolkit.getBestCursorSize(int preferredWidth,
int preferredHeight)
Returns the supported cursor dimension which is closest to the desired
sizes.
|
Point |
GraphicsEnvironment.getCenterPoint()
Returns the Point where Windows should be centered.
|
abstract ColorModel |
Toolkit.getColorModel()
Determines the color model of this toolkit's screen.
|
abstract GraphicsDevice |
GraphicsEnvironment.getDefaultScreenDevice()
Returns the default screen
GraphicsDevice . |
int |
Toolkit.getMaximumCursorColors()
Returns the maximum number of colors the Toolkit supports in a custom cursor
palette.
|
Rectangle |
GraphicsEnvironment.getMaximumWindowBounds()
Returns the maximum bounds for centered Windows.
|
int |
Toolkit.getMenuShortcutKeyMask()
Determines which modifier key is the appropriate accelerator
key for menu shortcuts.
|
Point |
Component.getMousePosition()
Returns the position of the mouse pointer in this
Component 's
coordinate space if the Component is directly under the mouse
pointer, otherwise returns null . |
Point |
Container.getMousePosition(boolean allowChildren)
Returns the position of the mouse pointer in this
Container 's
coordinate space if the Container is under the mouse pointer,
otherwise returns null . |
static int |
MouseInfo.getNumberOfButtons()
Returns the number of buttons on the mouse.
|
static PointerInfo |
MouseInfo.getPointerInfo()
Returns a
PointerInfo instance that represents the current
location of the mouse pointer. |
abstract GraphicsDevice[] |
GraphicsEnvironment.getScreenDevices()
Returns an array of all of the screen
GraphicsDevice
objects. |
Insets |
Toolkit.getScreenInsets(GraphicsConfiguration gc)
Gets the insets of the screen.
|
abstract int |
Toolkit.getScreenResolution()
Returns the screen resolution in dots-per-inch.
|
abstract Dimension |
Toolkit.getScreenSize()
Gets the size of the screen.
|
abstract Clipboard |
Toolkit.getSystemClipboard()
Gets the singleton instance of the system Clipboard which interfaces
with clipboard facilities provided by the native platform.
|
static Cursor |
Cursor.getSystemCustomCursor(String name)
Returns a system-specific custom cursor object matching the
specified name.
|
Clipboard |
Toolkit.getSystemSelection()
Gets the singleton instance of the system selection as a
Clipboard object. |
boolean |
Toolkit.isDynamicLayoutActive()
Returns whether dynamic layout of Containers on resize is
currently active (both set in program
(
isDynamicLayoutSet() )
, and supported
by the underlying operating system and/or window manager). |
protected boolean |
Toolkit.isDynamicLayoutSet()
Returns whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete.
|
boolean |
Toolkit.isFrameStateSupported(int state)
Returns whether Toolkit supports this state for
Frame s. |
protected void |
Toolkit.loadSystemColors(int[] systemColors)
Fills in the integer array that is supplied as an argument
with the current system color values.
|
abstract Map<TextAttribute,?> |
Toolkit.mapInputMethodHighlight(InputMethodHighlight highlight)
Returns a map of visual attributes for the abstract level description
of the given input method highlight, or null if no mapping is found.
|
void |
Toolkit.setDynamicLayout(boolean dynamic)
Controls whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete.
|
| Constructor and Description |
|---|
Button()
Constructs a button with an empty string for its label.
|
Button(String label)
Constructs a button with the specified label.
|
Checkbox()
Creates a check box with an empty string for its label.
|
Checkbox(String label)
Creates a check box with the specified label.
|
Checkbox(String label,
boolean state)
Creates a check box with the specified label
and sets the specified state.
|
Checkbox(String label,
boolean state,
CheckboxGroup group)
Constructs a Checkbox with the specified label, set to the
specified state, and in the specified check box group.
|
Checkbox(String label,
CheckboxGroup group,
boolean state)
Creates a check box with the specified label, in the specified
check box group, and set to the specified state.
|
CheckboxMenuItem()
Create a check box menu item with an empty label.
|
CheckboxMenuItem(String label)
Create a check box menu item with the specified label.
|
CheckboxMenuItem(String label,
boolean state)
Create a check box menu item with the specified label and state.
|
Choice()
Creates a new choice menu.
|
Frame()
Constructs a new instance of
Frame that is
initially invisible. |
Frame(String title)
Constructs a new, initially invisible
Frame object
with the specified title. |
Label()
Constructs an empty label.
|
Label(String text)
Constructs a new label with the specified string of text,
left justified.
|
Label(String text,
int alignment)
Constructs a new label that presents the specified string of
text with the specified alignment.
|
List()
Creates a new scrolling list.
|
List(int rows)
Creates a new scrolling list initialized with the specified
number of visible lines.
|
List(int rows,
boolean multipleMode)
Creates a new scrolling list initialized to display the specified
number of rows.
|
Menu()
Constructs a new menu with an empty label.
|
Menu(String label)
Constructs a new menu with the specified label.
|
Menu(String label,
boolean tearOff)
Constructs a new menu with the specified label,
indicating whether the menu can be torn off.
|
MenuBar()
Creates a new menu bar.
|
MenuComponent()
Creates a
MenuComponent . |
MenuItem()
Constructs a new MenuItem with an empty label and no keyboard
shortcut.
|
MenuItem(String label)
Constructs a new MenuItem with the specified label
and no keyboard shortcut.
|
MenuItem(String label,
MenuShortcut s)
Create a menu item with an associated keyboard shortcut.
|
PopupMenu()
Creates a new popup menu with an empty name.
|
PopupMenu(String label)
Creates a new popup menu with the specified name.
|
Scrollbar()
Constructs a new vertical scroll bar.
|
Scrollbar(int orientation)
Constructs a new scroll bar with the specified orientation.
|
Scrollbar(int orientation,
int value,
int visible,
int minimum,
int maximum)
Constructs a new scroll bar with the specified orientation,
initial value, visible amount, and minimum and maximum values.
|
ScrollPane()
Create a new scrollpane container with a scrollbar display
policy of "as needed".
|
ScrollPane(int scrollbarDisplayPolicy)
Create a new scrollpane container.
|
TextArea()
Constructs a new text area with the empty string as text.
|
TextArea(int rows,
int columns)
Constructs a new text area with the specified number of
rows and columns and the empty string as text.
|
TextArea(String text)
Constructs a new text area with the specified text.
|
TextArea(String text,
int rows,
int columns)
Constructs a new text area with the specified text,
and with the specified number of rows and columns.
|
TextArea(String text,
int rows,
int columns,
int scrollbars)
Constructs a new text area with the specified text,
and with the rows, columns, and scroll bar visibility
as specified.
|
TextField()
Constructs a new text field.
|
TextField(int columns)
Constructs a new empty text field with the specified number
of columns.
|
TextField(String text)
Constructs a new text field initialized with the specified text.
|
TextField(String text,
int columns)
Constructs a new text field initialized with the specified text
to be displayed, and wide enough to hold the specified
number of columns.
|
| Constructor and Description |
|---|
DragSource()
Creates a new
DragSource . |
DropTarget()
Creates a
DropTarget . |
DropTarget(Component c,
DropTargetListener dtl)
Creates a
DropTarget given the Component
to associate itself with, and the DropTargetListener
to handle event processing. |
DropTarget(Component c,
int ops,
DropTargetListener dtl)
Creates a
DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s) to support, and a
DropTargetListener to handle event processing. |
DropTarget(Component c,
int ops,
DropTargetListener dtl,
boolean act)
Creates a
DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s)
to support, a DropTargetListener
to handle event processing, and a boolean indicating
if the DropTarget is currently accepting drops. |
DropTarget(Component c,
int ops,
DropTargetListener dtl,
boolean act,
FlavorMap fm)
Creates a new DropTarget given the
Component
to associate itself with, an int representing
the default acceptable action(s) to
support, a DropTargetListener
to handle event processing, a boolean indicating
if the DropTarget is currently accepting drops, and
a FlavorMap to use (or null for the default FlavorMap ). |
| Modifier and Type | Method and Description |
|---|---|
abstract PageFormat |
PrinterJob.pageDialog(PageFormat page)
Displays a dialog that allows modification of a
PageFormat instance. |
PageFormat |
PrinterJob.pageDialog(PrintRequestAttributeSet attributes)
A convenience method which displays a cross-platform page setup dialog.
|
abstract boolean |
PrinterJob.printDialog()
Presents a dialog to the user for changing the properties of
the print job.
|
boolean |
PrinterJob.printDialog(PrintRequestAttributeSet attributes)
A convenience method which displays a cross-platform print dialog
for all services which are capable of printing 2D graphics using the
Pageable interface. |
| Modifier and Type | Method and Description |
|---|---|
static PrintService |
ServiceUI.printDialog(GraphicsConfiguration gc,
int x,
int y,
PrintService[] services,
PrintService defaultService,
DocFlavor flavor,
PrintRequestAttributeSet attributes)
Presents a dialog to the user for selecting a print service (printer).
|
| Modifier and Type | Method and Description |
|---|---|
protected JDialog |
JFileChooser.createDialog(Component parent)
Creates and returns a new
JDialog wrapping
this centered on the parent
in the parent 's frame. |
JDialog |
JOptionPane.createDialog(Component parentComponent,
String title)
Creates and returns a new
JDialog wrapping
this centered on the parentComponent
in the parentComponent 's frame. |
static JDialog |
JColorChooser.createDialog(Component c,
String title,
boolean modal,
JColorChooser chooserPane,
ActionListener okListener,
ActionListener cancelListener)
Creates and returns a new dialog containing the specified
ColorChooser pane along with "OK", "Cancel", and "Reset"
buttons. |
JDialog |
JOptionPane.createDialog(String title)
Creates and returns a new parentless
JDialog
with the specified title. |
static Frame |
JOptionPane.getFrameForComponent(Component parentComponent)
Returns the specified component's
Frame . |
static Frame |
JOptionPane.getRootFrame()
Returns the
Frame to use for the class methods in
which a frame is not provided. |
boolean |
JTable.print(JTable.PrintMode printMode,
MessageFormat headerFormat,
MessageFormat footerFormat,
boolean showPrintDialog,
PrintRequestAttributeSet attr,
boolean interactive)
Prints this table, as specified by the fully featured
print
method, with the default printer specified as the print service. |
boolean |
JTable.print(JTable.PrintMode printMode,
MessageFormat headerFormat,
MessageFormat footerFormat,
boolean showPrintDialog,
PrintRequestAttributeSet attr,
boolean interactive,
PrintService service)
Prints this
JTable . |
static int |
JOptionPane.showConfirmDialog(Component parentComponent,
Object message)
Brings up a dialog with the options Yes,
No and Cancel; with the
title, Select an Option.
|
static int |
JOptionPane.showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType)
Brings up a dialog where the number of choices is determined
by the
optionType parameter. |
static int |
JOptionPane.showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType)
Brings up a dialog where the number of choices is determined
by the
optionType parameter, where the
messageType
parameter determines the icon to display. |
static int |
JOptionPane.showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon)
Brings up a dialog with a specified icon, where the number of
choices is determined by the
optionType parameter. |
int |
JFileChooser.showDialog(Component parent,
String approveButtonText)
Pops a custom file chooser dialog with a custom approve button.
|
static Color |
JColorChooser.showDialog(Component component,
String title,
Color initialColor)
Shows a modal color-chooser dialog and blocks until the
dialog is hidden.
|
static String |
JOptionPane.showInputDialog(Component parentComponent,
Object message)
Shows a question-message dialog requesting input from the user
parented to
parentComponent . |
static String |
JOptionPane.showInputDialog(Component parentComponent,
Object message,
String title,
int messageType)
Shows a dialog requesting input from the user parented to
parentComponent with the dialog having the title
title and message type messageType . |
static Object |
JOptionPane.showInputDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
Object[] selectionValues,
Object initialSelectionValue)
Prompts the user for input in a blocking dialog where the
initial selection, possible selections, and all other options can
be specified.
|
static String |
JOptionPane.showInputDialog(Object message)
Shows a question-message dialog requesting input from the user.
|
static void |
JOptionPane.showMessageDialog(Component parentComponent,
Object message)
Brings up an information-message dialog titled "Message".
|
static void |
JOptionPane.showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType)
Brings up a dialog that displays a message using a default
icon determined by the
messageType parameter. |
static void |
JOptionPane.showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon)
Brings up a dialog displaying a message, specifying all parameters.
|
int |
JFileChooser.showOpenDialog(Component parent)
Pops up an "Open File" file chooser dialog.
|
static int |
JOptionPane.showOptionDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon,
Object[] options,
Object initialValue)
Brings up a dialog with a specified icon, where the initial
choice is determined by the
initialValue parameter and
the number of choices is determined by the optionType
parameter. |
int |
JFileChooser.showSaveDialog(Component parent)
Pops up a "Save File" file chooser dialog.
|
| Constructor and Description |
|---|
JApplet()
Creates a swing applet instance.
|
JFrame()
Constructs a new frame that is initially invisible.
|
JFrame(String title)
Creates a new, initially invisible
Frame with the
specified title. |
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved.


Columns
| Column ID |
Column Name |
Data Type |
Data Length |
Data Precision |
Data Scale |
Primary Key |
Foreign Key |
Unique Key |
Constraint |
Nullable |
Default Value |
Comments |
|
|
|
|
|
|
|
|
|
|
|
|
|
Primary Keys
| Primary Key |
Constraint Name |
Table Name |
Columns |
|
|
|
|
Unique Keys
| Unique Key |
Constraint Name |
Table Name |
Column |
|
|
|
|
Foreign Keys
| Child Table |
Child Column |
Constraint Name |
Join rule |
Parent Table |
Parent Columns |
|
|
|
. = .
|
|
|
Constraints
| Constraint Name |
Table Name |
Column Name |
Constraint |
Status |
|
|
|
|
|
Triggers
| Trigger Name |
Trigger Type |
Triggering Event |
Schema Name |
Object Name |
Object Type |
Status |
Script |
|
|
|
|
|
|
|
|
UDFs
| Function Name |
Return Type |
Arguments |
|
|
|
Stored Procedures
| Procedure Name |
Argument Name |
In/Out |
Data Type |
Data Length |
Data Precision |
Data Scale |
Defaulted |
Default Value |
|
|
|
|
|
|
|
|
|
Script
Database Scheduled Jobs
| Schema Name |
Job Name |
Job Style |
Job Type |
Job Action |
Start Date |
Schedule |
Last Start Date |
Next Run Date |
State |
|
|
|
|
|
|
|
|
|
|
Uses
| Referenced Type |
Referenced Object |
|
|
Used by
| Referencing Type |
Referencing Object |
|
|


GEOG*3480
GIS and Spatial Analysis
Basic Raster and Vector
Data Analysis Part 2
John Lindsay
Fall 2015
Remember, this is where the content for the final exam begins
Raster querying: Reclassification
Raster querying: Reclassification
Raster querying: Reclassification
- It is possible to build complex queries involving combinations of query questions
in the raster data model by using reclass, map algebra and/or Boolean logical
operations, and other spatial analysis operations (e.g. distance, buffering,
and area calculations).
- It is possible to perform any spatial query using either the raster or
vector data model, but it generally involves more steps using the
raster approach
Raster Buffering
- In a raster model, buffer creation is a two-step procedure:
- The distance from each cell to the target cell(s) is calculated
- Using resulting map is reclassified so that cells with values
less than the buffer distance are given the same code
Distance in the Raster Model
- Most modern GIS estimate the Euclidean distance of each raster grid cell to the nearest target cell
- Based on the highly efficient, 4-pass distance transform of Shih and Wu (2003)
- Some do not and some offer alternatives based on spread functions which
iteratively calculate distance through grid cells.
Distance in the Raster Model
- Why use spread to calculate distance?
- Until Shih and Wu (2003) spread has been far more efficient to estimate than Euclidean distance
- Spread is a powerful function for performing weighted distance operations, e.g. Least-cost analysis
(more to come on this later)
- Spread is less accurate but more powerful
Local Operations: Raster Map Overlay
- How are discrete spatial entities represented in raster?
- Point is a single cell
- Line is a cell-wide string of cells
- Area is a contiguous group of cells
- Raster map overlay works on a cell-by-cell basis
- Operations are performed on individual cells from two or more
input layers to produce a new layer
Raster overlay and map algebra
Comparison Operators
- Equal to, not equal to, greater than, less than, greater than or equal to, less
than or equal to (= , <>, >, < , >= , <=)
- > and < operators are like a simple reclassification
- Input images are not necessarily Boolean images but the output image is
always a Boolean
Comparison Operators
Comparison Operators
Comparison Operators
The MIN and MAX Operators
- MIN('Map1', 'Map2') & MAX('Map1', 'Map2', 'Map3')
- Assigns each cell in the output image the minimum (or maximum) value for the
corresponding cells in the input maps
- You may have two or more input maps
Mathematical operators
- Map addition, subtraction, multiplication, and division
- One-map/one-constant operations vs. two-map ops
- 'Map1' + 10
- 'Map1' - 'Map2'
- Why might you want to multiply or divide all the values in an image
by a constant (e.g. 'Map1' / 3.281)?
Jensen and Jensen, 2013
Other map algebra possibilities
- Complex mathematical combinations are possible
- e.g. Ln['catchmentAreaMap' / tan('slopeMap')]
- Must be careful not to divide by zero!
Considerations with raster map overlay
- Grid cell resolution...how to cope with incompatible resolutions of input images?
- Scale of input data, i.e. dichotomous (Boolean), nominal (categorical),
ordinal, interval, ratio
- Rarely perform a single operation; most GIS analyses require several operations
performed in series with several intermediate steps


Functions for parameter estimation, Bayesian posterior simulation and multiple imputation from incomplete multivariate data under a normal model.
| Version: | 2.0.2 |
| Depends: | R (≥ 3.1.0) |
| Imports: | stats |
| Published: | 2018-12-14 |
| Author: | Joseph L. Schafer |
| Maintainer: | Joseph L. Schafer <Joseph.L.Schafer at census.gov> |
| License: | GPL-3 |
| NeedsCompilation: | yes |
| Materials: | NEWS |
| CRAN checks: | norm2 results |
| Reference manual: | norm2.pdf |
| Package source: | norm2_2.0.2.tar.gz |
| Windows binaries: | r-devel: norm2_2.0.2.zip, r-release: norm2_2.0.2.zip, r-oldrel: norm2_2.0.2.zip |
| OS X binaries: | r-release: norm2_2.0.2.tgz, r-oldrel: norm2_2.0.2.tgz |
| Old sources: | norm2 archive |
Please use the canonical form https://CRAN.R-project.org/package=norm2 to link to this page.


Find out how old you are and your life expectancy on different planets!


DSC IEM invites all of you to become a part of the community and join the orientation session on 7th September (Saturday) from 10.30 AM at room 4.11, Gurukul Campus. The session will be conducted by Rimjhim Bhadani, Google Venkat Panchapakesan Scholar and the first-ever Google Summer of Code student from IEM.
DSC IEM invites all of you to become a part of the community and join the GSoC session. The session will be conducted by Rimjhim Bhadani, Google Venkat Panchapakesan Scholar and the first-ever Google Summer of Code student from IEM.She will discuss about what DSC IEM has to offer to you all, her experience with Google Summer of Code and how to start preparing for it and some very valuable tips to apply for the Google Scholarship and stand a chance to meet YouTube CEO.
Developer Students Club - IEM is happy to announce a Machine Learning Workshop Series starting from 12th September. The workshop will take you on an ML ride starting from a beginner level conducted by the best people from your own campus.
DSC IEM will be conducting its first Explore ML Session on 29th December, 2019. Explore Machine Learning (ML) is a Google-sponsored program for university students to get started with Machine Learning. The curriculum offers 3 tracks of machine learning content (Beginner, Intermediate, Advanced) and relies on university student facilitators to train other students on campus.


Playing with Jquery
Use JQuery to mess around with the boxes on the page. The only rules are you can't change the heading. If you need to add more boxes, go for it in the html. Try clicking the boxes to see the JQuery I've added so far in action! Enjoy.


Search
Preparing search index...
The search index is not available
leaflet.timeline
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Globals
"TimelineSliderControl"
"leaflet"
TimelineSliderControl
LayersObject
Interface LayersObject
Hierarchy
LayersObject
Indexable
[
name:
string
]:
Layer
Globals
Timeline
Slider
Control
Attribution
Layers
Scale
Zoom
Attribution
Options
Layers
Object
Layers
Options
Scale
Options
Zoom
Options
constructor
container
end
map
options
start
synced
Control
time
timelines
add
Timelines
add
To
get
Container
get
Position
next
on
Add
on
Remove
pause
play
prev
remove
remove
Timelines
set
Position
set
Time
sync
Control
toggle
add
Init
Hook
extend
include
merge
Options
timeline
Slider
Control
Generated using
TypeDoc


Class ODataResponseHTTP
Located at src/io/ODataResponseHTTP.php
public static
|
|
public static
|
|
public static
|
|
public static
|
#
successCreatedElement( object $element )
Success when a new element is created. Return the created object |
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|


With angular-enterprise-kickstart
we wanted to create a base
in which to develop enterprise AngularJS projects.
When analyzing how to define this base/kickstart we analyze several options and
ng-boilerplate was an excellent alternative, but it did not completely fit our needs
one of them was the usage of RequireJS as a main component of the framework
to ensure scalability as the project grow.
Our scope probably is narrower than ngBoilerplate. We do not look out to be every AngularJS project kickstart, rather we look forward to be a base for those projects planning to use AngularJS+RequireJS. We have found RequireJS being beneficial on medium size projects where modularization and code scalability is a must.
This is not an example of an AngularJS app. This is a kickstarter. If
you're looking for an example of what a complete, non-trivial AngularJS app
that does something real looks like, complete with a REST backend and
authentication and authorization, then take a look at angular-app
,
which does just that, and does it well.
This section is just a quick introduction to all the junk that comes
pre-packaged with angular-enterprise-kickstart
. For information on how to
use it, see the project page at
GitHub.
The high-altitude view is that the base project includes Twitter Bootstrap styles to quickly produce slick-looking responsive web sites and apps. It also includes UI Bootstrap, a collection of native AngularJS directives based on the aforementioned templates and styles. It also includes Font Awesome, a wicked-cool collection of font-based icons that work swimmingly with all manner of web projects; in fact, all images on the site are actually font- based icons from Font Awesome. Neat! Lastly, this also includes Angular Placeholders, a set of pure AngularJS directives to do client-side placeholder images and text to make mocking user interfaces super easy.
And, of course, ng-boilerplate
is built on AngularJS,
by the far the best JavaScript framework out there! But if you don't know
that already, then how did you get here? Well, no matter - just drink the
Kool Aid. Do it. You know you want to.
You already know about this, right? If not, hop on over and check it out; it's pretty sweet. Anyway, all that wonderful stylistic goodness comes built in. The LESS files are available for you to import in your main stylesheet as needed - no excess, no waste. There is also a dedicated place to override variables and mixins to suit your specific needs, so updating to the latest version of Bootstrap is as simple as:
$ cd vendor/twitter-bootstrap
$ git pull origin master
Boom! And victory is ours.
What's better than Bootstrap styles? Bootstrap directives! The fantastic UI Bootstrap library contains a set of native AngularJS directives that are endlessly extensible. You get the tabs, the tooltips, the accordions.  And more. How about a quick demo?
Oh, and don't include jQuery; you don't need it. This is better. Don't be one of those people. *
* Yes, there are exceptions.
Font Awesome has earned its label. It's a set of open (!) icons that come distributed as a font (!) for super-easy, lightweight use. Font Awesome works really well with Twitter Bootstrap, and so fits right in here.
There is not a single image on this site. All of the little images and icons are drawn through Font Awesome! All it takes is a little class:
<i class="icon-flag"></i>
And you get one of these: . Neat!
We are still validating if continuing to use Grunt as our build system. Although Grunt has become a semi-standard building tool among javascript projects there are new alternatives such as Gulp, Brunch and recently Brocolli. We are also aware that the build system can be simpler than it is right now, both for this project and ngBoilerplate.
We plan to migrate e2e tests from angular-scenario to Protractor which is the new recommended tool by the angular team. See more
We will also plan to build a small application example with this project to depict how to use the different technologies together.
We are open to all manner of ideas and suggestions. See the "Can I Help?" section below.
Yes, please!
Don't like the way we did something? Think you know of a better way? Have an idea to make this more useful? Let me know! You can contact me through all the usual channels or you can open an issue on the GitHub page. If you're feeling ambitious, you can even submit a pull request - how thoughtful of you!
So join the team! We're good people.


Our products are the best in the market it has its special traditional taste.
- Seattle
- Tokyo
- Dubai
- Paris
- Lima
Our Locations:
We are open from 7:00 am to 1:00 am everyday, welcome at any time.
Our products are the best in the market it has its special traditional taste.
Our Locations:
We are open from 7:00 am to 1:00 am everyday, welcome at any time.


- Advertiser Disclosure Founded: 2008
- VPN Countries: 55
- Money Back Guarantee: 30 Days
Overview
NordVPN is based in Panama but has a globally accessible service with customers in many different countries. As well as being one of the most security-conscious VPN providers on the market, its services benefit from allowing full use of P2P file-sharing platforms of all kinds.
The app also offers a SmartPlay feature which allows users to experience better streaming and access major streaming platforms across the world.
Customers can also connect up to six different devices at the same time as part of a standard package, which provides lots of scope for protected connectivity on desktop PCs as well as mobile devices without additional costs. And with a 30-day money-back guarantee, which is significantly longer than those offered by some other providers, customers can sign up without taking any risks and see if NordVPN meets their expectations.
What we like
- SmartPlay feature to access major streaming platforms
- 24/7 customer support available via Live Chat
- Based in Panama so not subject to US Data Retention or EU DRD laws
- 6 simultaneous connections with every package
What we like
No refunds on Bitcoin purchases
Speed
Speed is a crucial factor of how good a VPN is and to keep our users informed on how fast NordVPN is across countries, we regularly carry out speed tests.
| Download | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 |
| Upload | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 | 40.56 |
Privacy
As with all good anonymous VPN services, NordVPN does not log user activity in any form. So any external requests for usage data cannot be fulfilled, and user privacy is entirely assured. But its attention to detail when it comes to security goes even further, since it deploys Double VPN technology to effectively encrypt data twice. No other provider on the market at the moment can match this, although it is worth noting that this can lead to some speed inconsistencies because of the additional protections involved in achieving total privacy and anonymity. Payment can also be kept anonymous, since as well as accepting most credit cards, NordVPN’s services can also be purchased via Bitcoin, PayPal and more.
For added security and privacy, NordVPN has a Kill Switch feature which blocks all traffic to your device when your VPN connection drops. You can enable/disable this feature in the Settings tab.
Servers
NordVPN operates a network that includes 720+ servers spanning over 55 countries around the world. So it is suitable for accessing geographically restricted streaming content and sites in places such as the US and the UK as well as a range of other nations across Africa, Asia and the Middle East. Customers can choose to use a shared IP which is selected at random and changes whenever a new connection is established. Alternatively, a dedicated IP is available if required, and a list of 3000+ free proxies is also available for customers to harness if they wish.
WINNER PACKAGES FOR DECEMBER 2016
57%OFF
12 Months
$4.99 per month
- Servers in 87+ countries
- The fastest and most secure VPN
- Simple setup and configuration
- 30-Day Money Back Guarantee
35%OFF
12 Months
$4.99 per month
- Servers in 87+ countries
- The fastest and most secure VPN
- Simple setup and configuration
- 30-Day Money Back Guarantee
75%OFF
12 Months
$4.99 per month
- Servers in 87+ countries
- The fastest and most secure VPN
- Simple setup and configuration
- 30-Day Money Back Guarantee
DISCLAIMER
Prices may change frequently and despite our best efforts it is possible that some may be out of date.
Please visit the provider’s official website for exact pricing.


Map with a legend for areas
Map with a legend for areas
Alternative content for the map
Basic Modal Example
Open Modal
×
Modal Header
Some text in the modal.


I know that file descriptors (FD) 0, 1, and 2 are assigned to STDIN, STDOUT, and STDERR. I also know that FDs are assigned
in order. So what happened to 3 and 4?
12345678
1.9.3p286:015>STDIN.fileno=>01.9.3p286:034>IO.for_fd(3)ArgumentError:ThegivenfdisnotaccessiblebecauseRubyVMreservesitfrom(irb):34:in`for_fd' from (irb):34 from /Users/zlu/.rvm/rubies/ruby-1.9.3-p286/bin/irb:16:in `<main>'
Evidently some ruby process is using it, but what process?


United Way
Home
Local Opportunities
Committed
Settings
Logout
Please enter your location:
Submit
×
United Way would like to use your current location.
Turn On Location Services So We Can Find Volunteering Opportunities Near You.


Before Change
env.change_model(model=flag_model, difficulty=difficulty, seed=seed)
observation = env.reset(project=True, seed=seed)
except Exception as e_msg:
print("simulation error!!!")
print(e_msg)
//import pdb; pdb.set_trace()
return 0
env.spec.timestep_limit = timstep_limit+100
After Change
sim_t = 20
timstep_limit = int(round(sim_t/sim_dt))
init_error = True
error_count = 0
while init_error:
try:
locoCtrl = OsimReflexCtrl(mode=flag_ctrl_mode, dt=sim_dt)
env = L2M2019CtrlEnv(locoCtrl=locoCtrl, seed=seed, difficulty=difficulty, visualize=False)
env.change_model(model=flag_model, difficulty=difficulty, seed=seed)
observation = env.reset(project=True, seed=seed)
init_error = False
except Exception as e_msg:
error_count += 1
print("initialization error (x{})!!!".format(error_count))
//print(e_msg)
//import pdb; pdb.set_trace()
env.spec.timestep_limit = timstep_limit+100
total_reward = 0
error_sim = 0;