Exemple #1
0
    def __init__(self,
                 parent_widget,
                 parent_object,
                 resp,
                 resource,
                 filename=None,
                 menuAssocs={}):
        Frame.__init__(self, parent_widget)  # Superclass constructor
        self.searchlist = []  # Searchable terms...
        self.parent = parent_object
        self.cursel = None
        self.resp = resp
        self.resource = resource
        self.menuAssocs = menuAssocs
        self.createPopup()

        pmsgbar = self.parent.getMessageBar()
        if pmsgbar:
            self.balloons = Pmw.Balloon(parent_widget,
                                        statuscommand=pmsgbar.helpmessage)
        else:
            self.balloons = Pmw.Balloon(parent_widget)

        if self.useStatusLabels:
            labeltext = "%s:%d" % (resource.getHost(), int(resource.getPort()))

            if resource.getName() != '' and resource.getLocator() != '':
                label2 = "\"%s\" ID %s" % (resource.getName(),
                                           resource.getLocator())
            else:
                label2 = "    "
            if len(label2) > 50:
                label2 = label2[0:47] + "..."

            Label(self, text=labeltext).pack(side='top', expand=0, fill='x')
            Label(self, text=label2).pack(side='top', expand=0, fill='x')

        self.scrolled_window = Pmw.ScrolledCanvas(self,
                                                  borderframe=1,
                                                  usehullsize=1,
                                                  hull_width=400,
                                                  hull_height=400,
                                                  hscrollmode='dynamic',
                                                  vscrollmode='dynamic')

        self.sbox = Frame(self.scrolled_window.interior())
        self.scrolled_window.create_window(0, 0, anchor='nw', window=self.sbox)
        self.sbox.bind('<Button-3>', self.framePopupMenu)

        self.scrolled_window.interior().bind_all(
            '<Button-4>', functools.partial(self._on_mousewheel, scroll=-1))
        self.scrolled_window.interior().bind_all(
            '<Button-5>', functools.partial(self._on_mousewheel, scroll=1))

        self.scrolled_window.interior().bind('<Button-3>', self.framePopupMenu)

        # As very LAST thing, pack it in.
        self.scrolled_window.pack(fill='both', expand=1)
Exemple #2
0
    def tool_tip(self):
        """

        This method us used to bind tooltips to buttons.

        """
        # Button Find By ID tooltip (OB - 1)
        tooltip_find_by_id = Pmw.Balloon(self.presentor.root)
        tooltip_find_by_id.bind(self.button_clear_line,
                                "Clear the command line")

        # Button Find By Param tooltip (OB - 2)
        tooltip_find = Pmw.Balloon(self.presentor.root)
        tooltip_find.bind(
            self.button_find,
            "All table entries that contain the entered value are presented, enter the column name and the value: %column name% = %value%"
        )

        # Button Restore tooltip(OB - 3)
        tooltip_button_restore = Pmw.Balloon(self.presentor.root)
        tooltip_button_restore.bind(
            self.button_restore,
            "Click to restore the original table and clean the input box")

        # Button Query tooltip(OB - 4)
        tooltip_button_query = Pmw.Balloon(self.presentor.root)
        tooltip_button_query.bind(self.button_query,
                                  "Click to execute any valid SQL query")

        # Button Order By tooltip(OB - 5)
        tooltip_button_order_by = Pmw.Balloon(self.presentor.root)
        tooltip_button_order_by.bind(
            self.button_order_by,
            "Click to order table by column in ascending or descending order after the column name was entered: %column%"
        )

        # Button Columns tooltip(OB - 6)
        tooltip_button_columns = Pmw.Balloon(self.presentor.root)
        tooltip_button_columns.bind(
            self.button_columns,
            "Add the selected column to the string in the input box")

        #Export button tooltip (OB - 7)
        export__button_tooltip = Pmw.Balloon(self.presentor.root)
        export__button_tooltip.bind(self.button_export,
                                    "Export table content to EXCEL")

        # Button Show Only (OB - 8)
        show_only_button_tooltip = Pmw.Balloon(self.presentor.root)
        show_only_button_tooltip.bind(
            self.button_show_only,
            "Choose the columns you want to be presented separated by comma: %column name%, %column name%,%column name%"
        )

        # Button Show Only (OB - 9)
        limit_button_tooltip = Pmw.Balloon(self.presentor.root)
        show_only_button_tooltip.bind(
            self.button_limit,
            "Choose how many entires do you want to be presented")
Exemple #3
0
    def __init__(self, canvas):
        Pmw.initialise()
        self.balloon = Pmw.Balloon(canvas)
        self.canvas = canvas

        self.CANVAS_SIZE = 800

        # initiating variables to store images.
        self.scanner_image = PhotoImage(file='gui/images/WAP.gif')
        self.ap_image = PhotoImage(file='gui/images/ap2.gif')
        self.sta_image = PhotoImage(file='gui/images/sta.gif')

        # From Table2: Distance, average RSSI [dBm] and standard deviation for CC2420 ZigBee module:
        self.sig2dis = ([52, 2], [53, 4], [58, 6], [63, 9], [65, 12], [70, 15],
                        [76, 20], [82, 25])
        self.ch2bg = ([1, 'green'], [2, 'blue'], [3, 'tan'], [4, 'gray'],
                      [5, 'black'], [6, 'orange'], [7, 'pink'], [8, 'yellow'],
                      [9, 'white'], [10, 'purple'], [11, 'red'])

        # Draw circular disc region around Scanner device
        self.draw_oval_gradient()
        self.aps_count = 0
        self.stas_count = 0

        # Put an icon of Scanner device on the center of circular disc.
        scanner = self.canvas.create_image(402,
                                           402,
                                           image=self.scanner_image,
                                           anchor=CENTER,
                                           tags='scanner')
        # binding Pmw Balloon feature to 'scanner' item in canvas
        self.balloon.tagbind(
            self.canvas, scanner,
            'Scanner device\nMAC Address:\nInterface used:\nSignal strength:')
Exemple #4
0
    def __init__(self,type="simple"):
        root=Tkinter.Toplevel()
        

        # Create the message bar        
        messagebar = AUTOMessageBar(root,
                                    entry_width = 40,
                                    entry_relief='groove',
                                    labelpos = 'w',
                                    label_text = 'Status:')
        messagebar.pack(fill = 'x', padx = 10, pady = 10,side="bottom")

        # Create the body
        #body   = AUTOBody(root)
        #body.pack(fill="both",expand=1)

        if type=="simple":
            self.interface = AUTOSimpleGUIComponent(root,messagebar.printMessage)
        else:
            balloon = Pmw.Balloon(root)
            self.interface = AUTOExpertGUIComponent(root,messagebar.printMessage,
                                                    hull_relief = 'raised',
                                                    hull_borderwidth = 1,
                                                    balloon = balloon)
        self.interface.pack(fill = 'x',side="top")
 def add_entry(self,
               parent,
               par_name,
               entry_text,
               width,
               default_value="",
               tool_tip_text="",
               disabledbackground="gray",
               disabledforeground="white"):
     entry_string_var = tk.StringVar(value=entry_text)
     entry = tk.Entry(parent,
                      textvariable=entry_string_var,
                      width=width,
                      disabledbackground=disabledbackground,
                      disabledforeground=disabledforeground)
     self.ui_data_list.add(par_name=par_name,
                           tk_widget=entry,
                           widget_variable=entry_string_var,
                           default_value=default_value)
     self.update_if_obligatory_entries()
     if tool_tip_text != "":
         balloon = Pmw.Balloon(entry)
         balloon.bind(entry, tool_tip_text)
     self.bind_mouse_event(entry)
     return entry
Exemple #6
0
    def build_menu(self, parent):
        '''
        Create menu bar and items
        '''
        balloon = Pmw.Balloon(parent)
        #@todo: Look at replacing with Pmw.MainMenuBar
        menuBar = Pmw.MenuBar(parent, hull_relief=Tkinter.RAISED, hull_borderwidth=1, balloon=balloon)
        menuBar.pack(fill=Tkinter.X)
        #menuBar.grid(sticky=Tkinter.N)

        m=menuBar.addmenu('File', 'New..., Save..., Load..., Save Windows..., Restore Windows..., About...')
        menuBar.addmenuitem('File', 'command', 'Create a new main window.',
                    font=('StingerLight', 14), label='New...', command=self.new)
        menuBar.addmenuitem('File', 'command', 'Save to file cooresponding to selected notebook pane.',
                    font=('StingerLight', 14), label='Save...', command=self.save)
        menuBar.addmenuitem('File', 'command', 'Load to file cooresponding to selected notebook pane.',
                    font=('StingerLight', 14), label='Load...', command=self.load)
        menuBar.addmenuitem('File', 'command', 'Program Information.',
                    font=('StingerLight', 14), label='About...', command=self.about)
        menuBar.addmenuitem('File', 'command', 'Save Window Configuration...',
                label='Save Window Configuration', font=('StingerLight', 14), command=self.save_window_configuration)
        menuBar.addmenuitem('File', 'command', 'Restore Windows...',
                    label='Restore Windows', font=('StingerLight', 14), command=self.restore_windows)
        menuBar.addmenuitem('File', 'separator')
        menuBar.addmenuitem('File', 'command',
                    'Exit the application', label='Exit', command=self.exit)

        if self.__top == True:
            m2=menuBar.addmenu('TCP Server', 'Launch..., Connect..., Kill..')
            menuBar.addmenuitem('TCP Server', 'command', 'Start a TCP Threaded Socket Server in terminal',
                                font=('StingerLight', 14), label='Launch...', command=self.startTCP)
            menuBar.addmenuitem('TCP Server', 'command', 'Connect To Socket Server',
                                font=('StingerLight', 14), label='Connect...', command=self.connectTCP)
            menuBar.addmenuitem('TCP Server', 'command', 'Kill TCP Threaded Socket Server and terminal',
                                font=('StingerLight', 14), label='Kill...', command=self.killTCP)
Exemple #7
0
    def __init__(self):
        Frame.__init__(self)
        # Création d'un objet <bulle d'aide> (un seul suffit) :
        tip = Pmw.Balloon(self)
        # Création de la barre d'outils (c'est un simple cadre) :
        toolbar = Frame(self, bd=1)
        toolbar.pack(expand=YES, fill=X)
        # Nombre de boutons à construire :
        nBou = len(images)
        # Les icônes des boutons doivent être placées dans des variables
        # persistantes. Une liste fera l'affaire :
        self.photoI = [None] * nBou

        for b in range(nBou):
            # Création de l'icône (objet PhotoImage Tkinter) :
            self.photoI[b] = PhotoImage(file=images[b] + '.gif')
            # Création du bouton. On fait appel à une fonction lambda
            # pour pouvoir transmettre un argument à la methode <action> :
            bou = Button(toolbar,
                         image=self.photoI[b],
                         relief=GROOVE,
                         command=lambda arg=b: self.action(arg))
            bou.pack(side=LEFT)
            tip.bind(bou, textes[b])  # lien avec bulle d'aide

        self.ca = Canvas(self, width=400, height=200, bg='orange')
        self.ca.pack()
        self.pack()
Exemple #8
0
    def __init__(self, appli):
        """Constructeur de la fenêtre Paramétrage"""

        # variables locales
        vLigne = 1 # N° de ligne pour le positionnement des composants
        self.root = appli
        # Nouvelle fenêtre pour Pmw
        Toplevel.__init__(self)
        Pmw.initialise()
        # Paramétrage de la fenêtre
        if ( sys.platform.startswith('win')): 
            self.iconbitmap("appli.ico")
        self.resizable(width = False, height = False)
        self.wm_state()
        self.title ("Paramètres de Session")
        # C'est une fenêtre modale
        self.transient(self.root)
        self.grab_set() 
        self.focus_set()
        self.protocol("WM_DELETE_WINDOW", False)
        # Instanciation d'une bulle d'aide
        self.bulle = Pmw.Balloon(self, relmouse = 'both')

        # Composants de la fenêtre
        self.drawSession()
        self.initSession()
Exemple #9
0
    def test_03_buttonCommand(self):
        # test if we can activate button function
        global widget
        global buttonFuncs
        global pushedButton

        widget = Tkinter.Frame()
        widget.balloons = Pmw.Balloon(widget)

        tb = ToolBarButton(balloonmaster=widget,
                           master=widget,
                           name='smiley',
                           icon1='smiley.gif',
                           command=selectFunc,
                           state='normal')
        buttonFuncs['smiley'] = pushButton

        widget.pack()

        # call the button command which will call the method pushButton
        # which will set the value pushedButton from 0 to 1
        tb.buttonFocus = 1  # simulate mouse pointer entering button, else the
        # callback is not called
        tb.buttonUp(None)
        self.assertEqual(pushedButton == 1, True)
        pause(0.4)
        widget.master.destroy()
Exemple #10
0
    def test_02_multipleButtons(self):
        # test if we can have multiple buttons
        global widget
        global buttonFuncs
        widget = Tkinter.Frame()
        widget.balloons = Pmw.Balloon(widget)
        # add separator, 5 smilies, separator
        for key, func, balloon in [('sep1', None, None),
                                   ('smiley1', None, 'This is icon1'),
                                   ('smiley2', None, 'This is icon2'),
                                   ('smiley3', None, 'This is icon3'),
                                   ('smiley4', None, 'This is icon4'),
                                   ('smiley5', None, 'This is icon5'),
                                   ('sep2', None, None)]:

            ToolBarButton(widget,
                          widget,
                          name=key,
                          icon1='%s.gif' % key[:-1],
                          command=selectFunc,
                          balloonhelp=balloon)
            buttonFuncs[key] = func
        widget.pack()
        pause(0.6)
        widget.master.destroy()
Exemple #11
0
 def __init__(self, master):
    
    stream_data= {} #dictionary with saved streams
    parser_data= {} #dictionary with saved parser data for stations
    self.frame = Frame(master)
    # Create the Balloon.
    self.balloon = Pmw.Balloon(master) 
    #Create the menu bar
    self.makeMenuBar(master, self.balloon,stream_data,parser_data) 
     
    # Create and pack the canvas
    self.scrolledCanvas = Pmw.ScrolledCanvas(master,
              canvas_width = 500,
              canvas_height = 215)
    self.scrolledCanvas.pack()   
    
    #Create the button box   
    self.buttonBox = Pmw.ButtonBox(master,
              labelpos = 'nw',
              label_text = 'Data Processing',
              frame_borderwidth = 2,
              frame_relief = 'groove')
    self.buttonBox.pack(fill = 'both', expand = 1, padx = 10, pady = 10)
    
    self.buttonBox.add('Plot Stream Data',
          command = lambda: self.plot_stream_options(stream_data))
    self.buttonBox.add('Filter Options', 
          command = lambda: self.filter_options(stream_data))
    self.buttonBox.add('Convolution', 
         command = lambda: self.convolution_options(stream_data, parser_data))
    
    self.frame.pack()
Exemple #12
0
            def __init__(self, parent, row):
                self.did = None
                self.tm = None
                self.is_beeping = Tkinter.IntVar()
                self.set_b = Tkinter.Button(parent, text='Set', command=self.on_set)
                self.set_b.grid(row=row, column=0)
                self.clear_b = Tkinter.Button(parent, text='Clear', command=self.on_clear)
                self.clear_b.grid(row=row, column=1)

                self.check_b = Tkinter.Checkbutton(parent, text="", variable=self.is_beeping, borderwidth=0)
                self.check_b.grid(row=row, column=2)
                self.when = DatetimeField(parent, '', None, getcmd=None, setcmd=None, clearcmd=None,
                                          modifiedcommand=self.on_whenchange)
                self.balloon = Pmw.Balloon(parent)
                self.balloon.bind(self.when.date, 'YYYY/MM/DD')
                self.balloon.bind(self.when.time, 'HH:MM:SS')

                self.when.grid(row=row, column=3)
                self.scrollable = Pmw.EntryField(parent, value='')
                self.scrollable.component('entry').config(width=30)
                self.scrollable.grid(row=row, column=4)
                self.repeat = Repeat(parent, row=row, column=5)
                self.countdown = Countdown(parent, row=row, column=14)
                self.row = row

                self.clear_b.config(state=Tkinter.DISABLED)
                self.set_b.config(state=Tkinter.DISABLED)
                self.disable()
Exemple #13
0
    def createGUI(self):

        # set or create master
        if self.master is None:
            self.master = master = Tkinter.Toplevel()
            self.ownsMaster = True
        else:
            self.ownsMaster = False

        # create balloon
        self.balloon = Pmw.Balloon(self.master)
        # create top frame
        self.frame = fm = Tkinter.Frame(self.master)

        # create group for geometry chooser
        self.geomChooserG = w = Pmw.Group(fm, tag_text='Animateable objects')
        w.pack(side='left', fill='both', expand=1, padx=6, pady=6)

        # add a group for animation buttons (clips)
        self.makeActionsG = w = Pmw.Group(fm, tag_text='Create Action')
        w.pack(side='top', fill='both', expand=1, padx=6, pady=6)
        self.effectsContainer = w.interior()

        # add a group for saved animation clips
        self.createdActionsG = w = Pmw.Group(fm, tag_text="Created Actions")
        w.pack(side='top', fill='both', expand=1, padx=6, pady=6)

        self.frame.pack(side='left', fill='both', expand=1)
Exemple #14
0
    def __init__(self):
        self.start = Tk()
        self.start.title(
            "Emily's Final Project - Take 2")  #take 2 b/c take1 was a disaster
        self.start.geometry("300x200")

        self.msgs = Pmw.Balloon(self.start)

        self.buttonFrame = Frame(self.start, background="green")

        self.doodleButton = Button(self.start,
                                   text="Doodle",
                                   command=self.draw)
        self.doodleButton.pack()

        self.msgs.bind(self.doodleButton, "click here to simply draw!")

        self.play_game = Button(self.start,
                                text="Play A Game",
                                command=self.play)
        self.play_game.pack()
        self.msgs.bind(self.play_game, "click here for a two person game!")

        self.instructions = Label(
            self.start,
            text="To simply draw, click 'Doodle'.\n" + "\n" +
            "For the game, two players are needed.\n" +
            "P1 must draw the word \n" +
            " given on the screen in the allotted time. \n" +
            "P2 must then guess correctly the word in time.")
        self.instructions.configure(background="dodger blue",
                                    foreground="white")
        self.instructions.pack()
        self.start.mainloop()
Exemple #15
0
    def load_scan(self, scan_class):
        self._action_bool = IntVar()
        if self.hbox:
            self.hbox.destroy()
        if self.action_box:
            self.action_box.destroy()
        self.action_var = None
        self.balloon = Pmw.Balloon()

        cmd_line_actions = scan_class.cmd_line_actions()
        hbox = tk.Frame(self.parent)
        hbox.pack(anchor="nw", side="top")

        buttons = []
        count = 0
        for a_method, a_description in cmd_line_actions:
            b = tk.Radiobutton(
                hbox,
                text=a_description.name,
                value=count,
                command=lambda v=(a_method, a_description): self.
                show_action_params(v[0], v[1]),
                variable=self._action_bool,
            )
            self.balloon.bind(b, a_description.help)
            buttons.append(b)
            count += 1

        self._action_bool.set(-1)

        for b in buttons:
            b.pack(anchor="nw", side="left", padx=5)

        self.hbox = hbox
Exemple #16
0
    def makeMenus(self):
        # ------- create the menu bar -------
        self.mBar = Frame(self.master, relief='raised', borderwidth=1)
        self.balloon = Pmw.Balloon(self.master)

        self.leftframe = Frame(self.mBar) # , relief='raised', borderwidth=1)

        # Make the File menu
        Filebtn = Menubutton(self.leftframe, text='File', relief='flat')
        Filebtn.pack(side=LEFT, padx=5, pady=5)
        Filebtn.menu = Menu(Filebtn, tearoff=0)

        Filebtn.menu.add_command(label='Save selection', underline=0,
                                command=self.saveSelections)
        Filebtn.menu.add_command(label='Read selection', underline=0,
                                command=self.readSelections)
        Filebtn.menu.add_command(label='Close', underline=0,
                                     command=self.master.destroy)
        Filebtn['menu'] = Filebtn.menu

        # Make help menu
        Helpbtn = Menubutton(self.mBar, text='Help', underline=0, relief='flat')
        Helpbtn.pack(side=RIGHT, padx=5, pady=5)
        Helpbtn.menu = Menu(Helpbtn, tearoff=0)
        Helpbtn.menu.add_command(label='Keyboard shortcuts', underline=0, 
                                 command=self.shortcuts)
        Helpbtn['menu'] = Helpbtn.menu

        # Pack menu bar
        self.leftframe.pack(side=LEFT) # , padx=5, pady=5)
        self.mBar.pack(side='top', fill = 'x')
Exemple #17
0
    def _createPicOnly(self, picfname, balloon, linky):

        fname = os.path.join(sys.exec_prefix, 'bin/images', picfname)
        self._photo = Tkinter.PhotoImage(file=fname)

        self._displayWidth = min(self._photo.width(), self._logo.width())
        self._displayHeight = min(self._photo.height(), 400)
        self._display = Pmw.ScrolledCanvas(
            self,
            borderframe=1,
            usehullsize=1,
            hull_width=self._displayWidth,
            hull_height=self._displayHeight,
        )
        item = self._display.create_image(0, 0, image=self._photo, anchor='nw')
        self._balloon = Pmw.Balloon(self, relmouse='both')
        self._balloon.tagbind(
            self._display.component('canvas'), item,
            'Click to go to the "Getting Started with VCDAT" web page.')

        # Make the canvas a clickable link to the web page.
        self._link = linky
        self._display.pack()
        self._display.resizescrollregion()
        self._display.component('canvas').bind('<1>', self._onPicLeftClick)
        self._display.component('canvas')['cursor'] = 'hand2'
Exemple #18
0
    def setup(self):
        if self.usesmallfont:
            GG.prefs.font.setsmallfont()
            GG.padx=3
            GG.pady=3
        self.readUserPrefs()
        GG.icon = PhotoImage(data = spiderIcons.spider) #file = iconimage)
        # set up output streams for GUI
        self.msgfr = Frame(GG.topwindow,
                           relief=GG.frelief,
                           borderwidth=GG.brdr,
                           background=GG.bgd01)
        self.msgbox = Pmw.ScrolledText(self.msgfr, borderframe=4,
                                       vscrollmode='static',
                                       hscrollmode='dynamic',
                                       text_wrap='none')

        logfile = GG.sysprefs.logfile
        GB.outstream = GG.GUIOutput(self.msgbox, logfile)
        GB.errstream = GG.GUIOutput(self.msgbox, logfile)
        if GG.prefs.savelogfile:
            GB.outstream.uselogfile = 1
            GB.errstream.uselogfile = 1

        GG.balloon = Pmw.Balloon(GG.topwindow)
        GG.balloon.component('label').configure(font=GG.spid.font['small'])
Exemple #19
0
def showList(root, A=[3, 5, 7], font=default_font):
    bx, by = maxListNodeSize(A, font)
    dx = bx / 3
    dy = by / 3

    balloon = Pmw.Balloon(root)
    deltax = dx + bx
    sc = Pmw.ScrolledCanvas(root,
                            borderframe=1,
                            labelpos=N,
                            label_text='List',
                            usehullsize=1,
                            hull_width=10 + deltax * len(A) + dx,
                            hull_height=10 + 2 * by + 3 * dy)
    sc.icon = range(len(A))
    for i in range(len(A)):
        createNodeRectangle(sc,
                            i,
                            A[i],
                            deltax * i,
                            0,
                            deltax * i + bx,
                            by,
                            balloon=balloon,
                            font=font)
        pass
    #sc.pack()
    sc.resizescrollregion()
    return sc
Exemple #20
0
 def create_gui(self):
     self.root.title(AUDIO_PLAYER_NAME)
     self.balloon = Pmw.Balloon(self.root)
     self.create_top_display()
     self.create_button_frame()
     self.create_list_box()
     self.create_bottom_frame()
     self.create_context_menu()
Exemple #21
0
    def __init__(self, event_hub: EventsHub):
        super().__init__()
        self.kociemba_solver = KociembaSolver()
        self.basic_solver = BasicSolver()

        self.state_tooltip = Pmw.Balloon(self)
        self.state_tooltip.configure(label_font=("Courier", 8))
        self.tooltip = Pmw.Balloon(self)
        self.event_hub = event_hub
        self.title("RubiksCube controls")
        self.geometry("300x700+1200+200")
        self._create_state()
        self._create_view()
        self._create_controls()
        self._create_solvers()
        self._add_events_raisers()
        self._add_listeners()
Exemple #22
0
 def register_balloon(self, top):
     """
     Link our balloon with the top
     panel.
     """
     if self.__balloon is None:
         self.__balloon = Pmw.Balloon(top)
         self.__balloon.configure(statuscommand=self.update_helpmessage)
Exemple #23
0
    def __init__(self, parent, section):
        self.section = section
        self.settings = self.read_settings()
        self.changes_flag = False
        self.dialog = Pmw.Dialog(parent,
                                 buttons=('OK', 'Apply', 'Cancel'),
                                 defaultbutton='OK',
                                 title=section + ' Settings',
                                 command=self.execute)

        self.dialog.bind('<Escape>', self.cancel)

        self.balloon = Pmw.Balloon(self.dialog.interior(),
                                   label_wraplength=400)

        notebook = Pmw.NoteBook(self.dialog.interior())
        notebook.pack(fill='both', expand=1, padx=10, pady=10)

        self.entrydict = {section: {}}

        if section == 'General':
            subsections = [
                'General',
            ]
            subsettings = self.settings
        else:
            subsettings = self.settings[section]
            subsections = subsettings.sections
        for subsection in subsections:
            page = notebook.add(subsection)
            subsubsettings = subsettings[subsection]
            self.entrydict[section].update({subsection: {}})
            for itemname, itemvalue in subsubsettings.items():
                if not itemname.startswith('_'):
                    if not itemname.endswith('Tooltip'):
                        entry = Pmw.EntryField(page,
                                               labelpos='w',
                                               label_text='%s:' % itemname,
                                               validate=None,
                                               command=None)
                        if itemname.find("Password") == -1:
                            entry.setvalue(itemvalue)
                        else:
                            entry.setvalue(myutils.password_recover(itemvalue))
                        entry.pack(fill='x', expand=1, padx=10, pady=5)
                        self.balloon.bind(
                            entry,
                            subsubsettings[itemname + ' Tooltip'].replace(
                                '\\n', '\n'))
                        self.entrydict[section][subsection].update(
                            {itemname: entry})


        if len(self.entrydict.keys()) == 1 and \
                    self.entrydict.keys()[0] == 'General':
            self.entrydict = self.entrydict['General']

        notebook.setnaturalsize()
Exemple #24
0
    def createRecordDialog(self):
        self.balloon = Pmw.Balloon(self.master)
        dialog = Pmw.Dialog(
            self.master, buttons=['Record', 'Cancel'], defaultbutton='Record',
            title="Record Options")
        dialog.withdraw()
        # create a frame to hold group to force setting orient and rendering
        frame = Tkinter.Frame(dialog.interior())

        bn = Tkinter.Button(frame, text="Save As:", command = self.browseFile_cb,
                            width= 0, height=0)
        self.balloon.bind(bn, "Opens file browser")
        bn.grid(row=0, column=0,sticky='ew')
        
        filename = 'movie_'+strftime("%m-%d-%Y_%H:%M")+'.mpg'
        self.filenamew = fn = Pmw.EntryField(frame, command = self.getFileName_cb,
                                             entry_width = 35,
                                             value = filename)
        fn.grid( row=0, column = 1,sticky ='w') #columnspan=2)
        self.balloon.bind(fn, "type filename" )
        self.codecw = Pmw.RadioSelect(frame, labelpos='w', label_text="Codec:",
                                      selectmode='single', orient='horizontal',
                                      buttontype='radiobutton', command=self.setCodec_cb)
        for text in ['mpeg1video', 'mpeg2video']:
            self.codecw.add(text)

        self.codecw.grid( row=1, column=0, columnspan=2, sticky='ew')
        self.cameraSizeMenub = None
        if self.vf:
            listitems = self.resolutions.keys()
##             csize = Pmw.ComboBox(frame, labelpos = 'w',
##                                 label_text = 'Camera Size:',
##                                 #entryfield_validate = self.entryValidate,
##                                 entryfield_value="current",
##                                 scrolledlist_items=listitems, 
##                                 #fliparrow=1,
##                                  history=False,
##                                  selectioncommand=self.setCameraSize_cb)
            
##             csize.grid( row=2, column=0, columnspan=2, sticky='ew')
            self.cameraSizeMenub = mb= Tkinter.Menubutton(frame, text='Select camera size...',
                           underline=0, relief='raised')
            #mb('<Button-1>', toggleMenu, '+')
            mb.grid( row=2, column=0, columnspan=2, sticky='ew')
            mb.menu = Tkinter.Menu(mb)
            for s in self.resolutions.keys():
                mb.menu.add_radiobutton(label=s,
                                        var=self.cameraSize,
                                        value = s,
                                        command = self.setCameraSize_cb)
            mb.menu.add_radiobutton(label="current", var=self.cameraSize,
                                    value="current",
                                    command = self.setCameraSize_cb)
            mb['menu'] = mb.menu
            self.balloon.bind(mb, "Left-Click to select camera size")
        frame.pack( fill='x', expand=1)
        return dialog
Exemple #25
0
    def add_button(self, parent, btn_text="Button", w=3, h=3,
                   tool_tip_text=None):
        btn = tk.Button(parent, text=btn_text, width=w, height=h)
        if tool_tip_text != None:
            balloon = Pmw.Balloon(btn)
            balloon.bind(btn, tool_tip_text)

        self.bind_mouse_event(btn)
        return btn
Exemple #26
0
 def onAddCmdToViewer(self):
     if self.vf.GUI:
         root = self.vf.GUI.ROOT
         self.viewMenu = Tkinter.Menu(root, title="View")
         self.viewMenu.add_command(label="Edit")
         self.viewMenu.add_command(label="Rename")
         self.viewMenu.add_command(label="Remove")
         self.viewMenu.add_command(label="Update icon")
         self.viewMenu.add_command(label="Dismiss")
         self.viewsBalloon = Pmw.Balloon(root)
def btn_url_clicked():
    global loading, chapter_list
    if loading:
        print(
            "It's currently fetching the mango info. Please do not overload the app"
        )
        return
    #prevents url fetching when currently processing a job
    loading = True
    #clears any previous mangoes from listbox
    lb_chapters.delete(0, END)
    data = get_chapters(txt_url.get())

    #on the event an error occurs midway
    if data == False:
        loading = False
        return

    try:
        title = html.unescape(data["mango_title"])
        description = data["description"]
        chapter_list = data["chapter_list"]
        cover_url = data["cover_url"]

        #formatting, adjusting tooltip width and removing other languages
        #most descriptions use \r and \n to separate languages so it may face complications in some mangoes
        description = html.unescape(description[0:description.find("\r")])
        description = fit_description(description, 120)

        for chapter in chapter_list:
            lb_chapters.insert(
                END,
                "   Ch {} | {}   ".format(chapter["chapter"],
                                          html.unescape(chapter["group"])))
        lbl_title.config(text=title)
        lb_chapters.config(width=0)
    except Exception as ex:
        print("Error with fetching mango info")
        print(ex)
        loading = False

    try:
        set_tk_image(cover_url, lb_chapters, img_thumb)
        balloon = Pmw.Balloon(root)
        balloon.bind(
            img_thumb, description
            if description else "Description would've gone here if it existed")
    except Exception as ex:
        print("Error with image: " + ex.args[0])
        loading = False

    root.config(height=0)
    #reallows url fetching upon finishing
    loading = False
Exemple #28
0
    def makeMenus(self):
        self.mBar = Frame(self.top, relief='raised', borderwidth=1)
        self.mBar.pack(side='top', fill='x')
        self.balloon = Pmw.Balloon(self.top)

        # Make the File menu
        Filebtn = Menubutton(self.mBar,
                             text='File',
                             underline=0,
                             relief='flat')
        Filebtn.pack(side=LEFT, padx=5, pady=5)
        Filebtn.menu = Menu(Filebtn, tearoff=0)
        Filebtn.menu.add_command(label='Class avgs',
                                 command=self.getClassAverages)
        Filebtn.menu.add_command(label='Templates', command=self.callTemplates)
        Filebtn.menu.add_command(label='Close all windows',
                                 command=self.closeWindows)
        Filebtn.menu.add_separator()
        Filebtn.menu.add_command(label='Quit',
                                 underline=0,
                                 command=self.master.quit)
        Filebtn['menu'] = Filebtn.menu

        # Make the Display menu (same as montage.py)
        Dspbtn = Menubutton(self.mBar, text='Display', relief='flat')
        Dspbtn.pack(side=LEFT, padx=5, pady=5)
        Dspbtn.menu = Menu(Dspbtn, tearoff=0)

        Dspbtn.menu.add_command(label='no. columns',
                                underline=0,
                                command=self.displayParms)
        Dspbtn.menu.add_checkbutton(label='show filenames',
                                    underline=0,
                                    variable=self.showVar,
                                    command=self.displayParms_1)
        # 'size' has a submenu of checkbuttons
        Dspbtn.menu.sizes = Menu(Dspbtn.menu)
        Dspbtn.menu.sizes.add_radiobutton(label='1/2',
                                          underline=0,
                                          variable=self.sizeVar,
                                          value=0,
                                          command=self.displayParms_2)
        Dspbtn.menu.sizes.add_radiobutton(label='1x',
                                          underline=0,
                                          variable=self.sizeVar,
                                          value=1,
                                          command=self.displayParms_2)
        Dspbtn.menu.sizes.add_radiobutton(label='2x',
                                          underline=0,
                                          variable=self.sizeVar,
                                          value=2,
                                          command=self.displayParms_2)
        Dspbtn.menu.add_cascade(label='image size', menu=Dspbtn.menu.sizes)
        Dspbtn['menu'] = Dspbtn.menu
Exemple #29
0
 def createGuessEntryWidget(self, parent):
     """Guess entry widget"""
     fr = Pmw.ScrolledFrame(parent,labelpos = 'n',
                               label_text='guess')
     fr.pack(fill=BOTH,side=TOP,expand=1,padx=4)
     fr.configure(horizflex = 'expand')
     balloon = Pmw.Balloon(self.main)
     balloon.bind(fr, 'Models usually require initial guesses.\n'
                      'Enter a calculation or float value for any variable.')
     self.guessentry = fr
     return fr
Exemple #30
0
    def doBaseForm(self, master):
        # Create the Balloon.
        self.balloon = Pmw.Balloon(master)

        self.menuBar = Pmw.MenuBar(master,
                                   hull_borderwidth=1,
                                   hull_relief='raised',
                                   hotkeys=1,
                                   balloon=self.balloon)
        self.menuBar.pack(fill='x')
        self.menuBar.addmenu('File', 'Exit')
        self.menuBar.addmenuitem('File',
                                 'command',
                                 'Exit the application',
                                 label='Exit',
                                 command=self.exit)
        self.menuBar.addmenu('View', 'View user information')
        self.menuBar.addmenuitem('View',
                                 'command',
                                 'Get user information',
                                 label='Get info',
                                 command=self.getStatus)
        self.menuBar.addmenu('Help', 'About Example 10-4', side='right')
        self.menuBar.addmenuitem('Help',
                                 'command',
                                 'Get information on application',
                                 label='About...',
                                 command=self.help)

        self.dataFrame = Frame(master)
        self.dataFrame.pack(fill='both', expand=1)

        self.infoFrame = Frame(self.root, bd=1, relief='groove')
        self.infoFrame.pack(fill='both', expand=1, padx=10)

        self.statusBar = Pmw.MessageBar(master,
                                        entry_width=40,
                                        entry_relief='groove',
                                        labelpos='w',
                                        label_text='')
        self.statusBar.pack(fill='x', padx=10, pady=10)

        # Add balloon text to statusBar
        self.balloon.configure(statuscommand=self.statusBar.helpmessage)

        # Create about dialog.
        Pmw.aboutversion('10.4')
        Pmw.aboutcopyright('Copyright My Company 1999\nAll rights reserved')
        Pmw.aboutcontact('For information about this application contact:\n' +
                         '  My Help Desk\n' + '  Phone: 800 555-1212\n' +
                         '  email: [email protected]')
        self.about = Pmw.AboutDialog(master, applicationname='Example 10-4')
        self.about.withdraw()