Example #1
0
 def __init__(self, parent, main, opts):
     self.main = main
     self.opts = opts
     self.options = {}
     self.choiceoptions = {}
     self.booloptions = {}
     Dialog.__init__(self, parent, title="Preferences")
Example #2
0
 def __init__(self,parent,title=None,
              inputs=None,
              name=None):
     MyLoggingBase.__init__(self,name=name)
     self.__inputs = inputs.copy()
     
     Dialog.__init__(self,parent=parent,title=title)
Example #3
0
    def __init__(self, master, icon=None, app_name=None, description=None, copyright=None, website=None):
        self.app_name = app_name
        self.icon = icon
        self.description = description
        self.copyright = copyright
        self.website = website

        Dialog.__init__(self, master)
Example #4
0
    def apply(self):
        '''process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        '''
        Dialog.apply(self)
        
Example #5
0
 def __init__(self, title, prompt, pattern=None, default=None, master=None):
   if not master:
     master = tkinter._default_root
   self.prompt = prompt
   self.default = default
   self.pattern = re.compile(pattern)
   Dialog.__init__(self, master, title)
   return
Example #6
0
    def __init__(self, parent, latest):

        self._parent = parent
        self._latest_score = latest

        # self.parent.bind("<Return>", lambda x: print("You pressed enter"))

        Dialog.__init__(self, parent, 'Top Scores')
 def __init__(self, parent,title,type,src,dest,auth):
     self.type=type
     self.src=src
     self.dest=dest
     self.auth=auth
     self.action=0
     self.rem_ = None
     self.dec_ = None
     Dialog.__init__(self, parent, title)
Example #8
0
    def __init__(self, title, prompt=None, initialvalue=None, parent=None):

        if not parent:
            parent = tk._default_root

        self.prompt = prompt
        self.initialvalue = initialvalue

        Dialog.__init__(self, parent, title)
Example #9
0
 def __init__(self, parent, title=None, initialvalues=None, labels=None,
                 types=None, tooltips=None):
     if labels != None and types is not None:
         self.initialvalues = initialvalues
         self.labels = labels
         self.types = types
         self.tooltips = tooltips
     Dialog.__init__(self, parent, title)
     #super(MultipleValDialog, self).__init__(parent, title)
     return
Example #10
0
    def __init__(self, title, prompt, choiceList, parent=None):

        if not parent:
            parent = irafutils.init_tk_default_root()

        self.__prompt = prompt
        self.__choices = choiceList
        self.__retval = None
        self.__clickedOK = False
        parent.update()
        Dialog.__init__(self, parent, title) # enters main loop here
Example #11
0
 def __init__(self, master, title='', content=''):
     self.content = content
     self.style = ttk.Style(master)
     resource_dir = abspath(
         path_join(sys.argv[0], pardir, pardir, 'Resources'))
     logo_file = path_join(resource_dir, 'sage_logo_256.png')
     try:
         self.logo_image = tkinter.PhotoImage(file=logo_file)
     except tkinter.TclError:
         self.logo_image = None
     Dialog.__init__(self, master, title=title)
Example #12
0
    def __init__(self, parent, title=None, initialvalues=None, labels=None,
                    types=None, tooltips=None):
        if labels != None and types is not None:
            self.initialvalues = initialvalues
            self.labels = labels
            self.types = types
            self.tooltips = tooltips

        Dialog.__init__(self, parent, title)
        #super(MultipleValDialog, self).__init__(parent, title)
        return
Example #13
0
    def __init__(self, parent, string):
        '''Provides the ability to amipulate a string by inputting code.

        Arguments:
            string: the string to be manipulated.
        '''

        self.string = string
        self.code = None

        Dialog.__init__(self, parent, 'Enter Code')
Example #14
0
 def __init__(self, parent, title=None, initialvalues=None, labels=None,
                 types=None, tooltips=None):
     if labels != None and types is not None:
         self.initialvalues = initialvalues
         self.labels = labels
         self.types = types
         self.tooltips = tooltips
     s=Style()
     #bg = s.lookup('TLabel.label', 'background')
     #s.configure('TFrame', background='white')
     Dialog.__init__(self, parent, title)
     #super(MultipleValDialog, self).__init__(parent, title)
     return
Example #15
0
    def __init__(self,
                 master,
                 icon=None,
                 app_name=None,
                 description=None,
                 copyright=None,
                 website=None):
        self.app_name = app_name
        self.icon = icon
        self.description = description
        self.copyright = copyright
        self.website = website

        Dialog.__init__(self, master)
Example #16
0
    def destroy(self):
        # first save the selected index before it is destroyed
        idx = self.get_current_index()
        # in PyRAF, assume they meant the first one if they clicked nothing,
        # since it is already active (underlined)
        if idx < 0: idx = 0
        # get the object at that index
        if self.__clickedOK and idx >= 0: # otherwise is None
            self.__retval = self.__choices[idx]
        if self.__retval and type(self.__retval) == str:
            self.__retval = self.__retval.strip()

        # now destroy
        self.__lb = None
        Dialog.destroy(self)
Example #17
0
    def destroy(self):
        # first save the selected index before it is destroyed
        idx = self.get_current_index()
        # in PyRAF, assume they meant the first one if they clicked nothing,
        # since it is already active (underlined)
        if idx < 0: idx = 0
        # get the object at that index
        if self.__clickedOK and idx >= 0: # otherwise is None
            self.__retval = self.__choices[idx]
        if self.__retval and type(self.__retval) == str:
            self.__retval = self.__retval.strip()

        # now destroy
        self.__lb = None
        Dialog.destroy(self)
Example #18
0
    def __init__(self,
                 parent,
                 entry,
                 ledger,
                 possible_duplicate=None,
                 title='Get some Help!',
                 sess_id='noid'):
        self.entry = entry
        self.duplicate = possible_duplicate
        self.ledger = ledger

        self.sess_id = sess_id

        self.rule = None

        Dialog.__init__(self, parent, title)
Example #19
0
    def validate(self):
        '''validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        '''
        if Dialog.validate(self) == 0: return 0
        
        for k,entry in self.__entries.items():
            s = entry.get()
            
            # validate if needed
            if self.__inputs[k] is not None and self.__inputs[k] != s:
                # validate data type
                t = type(self.__inputs[k])
                try:
                    v = t(s)
                except ValueError as e:
                    # failed!
                    tk.messagebox.showwarning(
                        e.__class__.__name__,
                        "'{0}' must be of type '{1}'!\nPlease try again".format(k,t.__name__),
                        parent = self
                    )
                    return 0
                else:
                    # good to go, override default with value
                    self.__inputs[k] = v
        
        # passed all validation! - 'apply' to result
        self.result = self.__inputs
        return 1
Example #20
0
    def __init__(self, title, prompt, choiceList, parent=None):

        if not parent:
            if PY3K:
                import tkinter
                parent = tkinter._default_root
            else:
                import Tkinter
                parent = Tkinter._default_root
            parent.withdraw()

        self.__prompt = prompt
        self.__choices = choiceList
        self.__retval = None
        self.__clickedOK = False
        parent.update()
        Dialog.__init__(self, parent, title)  # enters main loop here
Example #21
0
    def __init__(self, title, prompt, choiceList, parent=None):

        if not parent:
            if PY3K:
                import tkinter
                parent = tkinter._default_root
            else:
                import Tkinter
                parent = Tkinter._default_root
            parent.withdraw()

        self.__prompt = prompt
        self.__choices = choiceList
        self.__retval = None
        self.__clickedOK = False
        parent.update()
        Dialog.__init__(self, parent, title) # enters main loop here
Example #22
0
    def __init__(self, title, prompt, options, defaultValue=None, parent=None):
        if not parent:
            parent = tkinter._default_root

        self.selected = None
        self.optionMenu = None

        self.prompt = prompt

        if not options:
            raise Exception("No options given")

        # If options is not a dict type, assume it's a list and convert it to a dict
        if isinstance(options, abc.Mapping):
            self.options = options
        else:
            self.options = {str(v): v for v in options}

        self.defaultValue = defaultValue

        Dialog.__init__(self, parent, title)
Example #23
0
    def __init__(self,
                 parent,
                 entry=None,
                 ledger=[],
                 rule=None,
                 title='Edit Rule',
                 sess_id='noid'):
        self.entry = entry
        self.rule = rule

        self.ledger = ledger

        self.sess_id = sess_id

        self.kind = None if not entry else type(entry).__name__
        self.kind = self.kind if not rule else rule['kind']

        self.newRule = getProtoRule(self.kind, self.entry)

        self.mode = 'edit' if rule is not None else 'add'

        Dialog.__init__(self, parent, title)
Example #24
0
    def body(self, master):
        '''create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        '''
        Dialog.body(self, master)
        
        # set icon
        try: self.wm_iconbitmap(self.get_resource_fd('python-icon.ico'))
        except tk.TclError: pass # in ubuntu: _tkinter.TclError: bitmap /.../... not defined
        
        # add inputs
        self.__entries = dict()
        first_key = None
        r = 0
        for k,v in self.__inputs.items():
            # get first entry added so we can set that to have focus
            if first_key is None: first_key = k
            
            # create label
            ttk.Label(master, text=k+':',justify=tk.LEFT).grid(row=r,column=0,sticky=tk.W)
            
            # create entry
            e = ttk.Entry(master,width=9)
            e.grid(row=r,column=1)
            # set default input if any
            if v is not None: e.insert(0, v)
            # add to list
            self.__entries[k] = e
            
            # next row!
            r += 1
        
        # set focus to first entry
        if self.__entries: return self.__entries[first_key]
Example #25
0
 def destroy(self):
     self.entry = None
     Dialog.destroy(self)
Example #26
0
 def __init__(self, title, prompt, parent):
     self.prompt = prompt
     Dialog.__init__(self, parent, title)
Example #27
0
 def __init__(self, title, prompt, parent):
     self.prompt = prompt
     Dialog.__init__(self, parent, title)
Example #28
0
 def __init__(self, master, title="New Option"):
     Dialog.__init__(self, master, title)
Example #29
0
 def ok(self, val=None):
     self.__clickedOK = True # save that this wasn't a cancel
     Dialog.ok(self, val)
Example #30
0
 def __init__(self, parent, title="Tmailer", message=""):
     self.message = message
     Dialog.__init__(self, parent, title)
Example #31
0
 def __init__(self, parent):
     Dialog.__init__(self, parent, "Calendario")
Example #32
0
 def destroy(self):
     self.optionMenu = None
     self.selected = None
     Dialog.destroy(self)
Example #33
0
 def __init__(self, parent, h5name, title=None):
     self.h5name = h5name
     Dialog.__init__(self, parent, title=title)
Example #34
0
 def __init__(self, title, prompt, master=None):
   if not master:
     master = tkinter._default_root
   self.prompt = prompt
   Dialog.__init__(self, master, title)
   return
Example #35
0
 def ok(self, val=None):
     self.__clickedOK = True # save that this wasn't a cancel
     Dialog.ok(self, val)
Example #36
0
 def __init__(self, addrdlg, book, entry):
     self.addrdlg = addrdlg
     self.entry = entry
     self.book = book
     Dialog.__init__(self, addrdlg, title="Edit Contact")
Example #37
0
 def __init__(self, parent, main):
     self.main = main
     Dialog.__init__(self, parent, title="Address Book")
 def cancel(self,event=None):
     Dialog.cancel(self, event)