Exemple #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")
 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)
Exemple #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)
    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)
        
Exemple #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
Exemple #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)
Exemple #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)
Exemple #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
Exemple #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
Exemple #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)
Exemple #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
Exemple #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')
Exemple #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
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
    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
Exemple #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
Exemple #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
Exemple #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)
Exemple #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)
    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]
Exemple #25
0
 def destroy(self):
     self.entry = None
     Dialog.destroy(self)
 def __init__(self, title, prompt, parent):
     self.prompt = prompt
     Dialog.__init__(self, parent, title)
Exemple #27
0
 def __init__(self, title, prompt, parent):
     self.prompt = prompt
     Dialog.__init__(self, parent, title)
Exemple #28
0
 def __init__(self, master, title="New Option"):
     Dialog.__init__(self, master, title)
Exemple #29
0
 def ok(self, val=None):
     self.__clickedOK = True # save that this wasn't a cancel
     Dialog.ok(self, val)
Exemple #30
0
 def __init__(self, parent, title="Tmailer", message=""):
     self.message = message
     Dialog.__init__(self, parent, title)
Exemple #31
0
 def __init__(self, parent):
     Dialog.__init__(self, parent, "Calendario")
Exemple #32
0
 def destroy(self):
     self.optionMenu = None
     self.selected = None
     Dialog.destroy(self)
Exemple #33
0
 def __init__(self, parent, h5name, title=None):
     self.h5name = h5name
     Dialog.__init__(self, parent, title=title)
Exemple #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
Exemple #35
0
 def ok(self, val=None):
     self.__clickedOK = True # save that this wasn't a cancel
     Dialog.ok(self, val)
Exemple #36
0
 def __init__(self, addrdlg, book, entry):
     self.addrdlg = addrdlg
     self.entry = entry
     self.book = book
     Dialog.__init__(self, addrdlg, title="Edit Contact")
Exemple #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)