Example #1
0
 def body(self, parent):
     import notebook
     notebook = notebook.notebook(parent, side=TOP)
     for group in self.opts:
         tab = Frame(notebook())
         for optnumber, option in enumerate(group):
             optf = Frame(tab)
             label = Label(optf, text=getPrettyName(option))
             label.pack(fill=Y, side=LEFT)
             if option.type in ( 'String', 'Integer', 'Password' ):
                 if option.type == 'Password':
                     edit = Entry(optf, show='*')
                 else:
                     edit = Entry(optf)
                 val = option.getValue()
                 if val and val is not NoDefaultOption:
                     edit.insert(0,str(val))
                 edit.pack(fill=BOTH, side=RIGHT)
                 get = edit.get
                 edit = ( optf, label, edit )
             elif option.type == 'Choice':
                 rbf = Frame(optf)
                 buttons = []
                 name = option.name
                 val = option.value
                 self.choiceoptions[name] = val
                 for c in [x.value for x in option]:
                     if c == val:
                         E = 1
                     else:
                         E = 0
                     b = Radiobutton(rbf, text=c, indicatoron=1,
                                     variable=self.choiceoptions[name],
                                     value=c,
                                     command=lambda o=self.choiceoptions, n=name, c=c: o.__setitem__(n,c) )
                     if E:
                         b.select()
                     else:
                         b.deselect()
                     b.pack(side=LEFT)
                     buttons.append(b)
                 rbf.pack(side=RIGHT, fill=BOTH)
                 get = lambda opt=name: self.choiceoptions[opt]
                 edit = ( rbf, buttons )
             elif option.optionType == 'Boolean':
                 name = option.name
                 val = option.value
                 self.booloptions[name] = val
                 b = Checkbutton(optf, variable=self.booloptions[name],
                                 command=lambda o=self.booloptions, n=name: o.__setitem__(n, not o[n]) )
                 b.pack(side=RIGHT, fill=BOTH)
                 edit = b
                 get = lambda opt=name: self.booloptions[opt]
             else:
                 raise ValueError, "unknown option type %s"%(option.optionType)
             optf.pack(fill=X, side=TOP, ipady=4)
             if edit is not None:
                 self.options[option.name] = ( option.type, get, edit )
         notebook.add_screen(tab, group.name)
     return notebook()
Example #2
0
def parse(arg):
    'Parser for app console, returns note and notebook objects'
    arguments = arg.split()  # Split arguments
    global on, onb

    if len(arguments):

        if arguments[0] == 'onb' or arguments[0] == 'opennotebook':
            if len(arguments) == 2:
                onb = opennb(arguments[1])

        if arguments[0] == 'lnb' or arguments[0] == 'listnotebook':
            print('The following notebook are present :')
            for ntb in notebooks:
                print(' *', ntb.title)

        if arguments[0] == 'nnb' or arguments[0] == 'newnotebook':
            if len(arguments) == 1:
                onb = nb.notebook()
                notebooks.append(onb)

            else:
                onb = nb.notebook(arguments[1])
                notebooks.appned(onb)

        if arguments[0] == 'nn' or arguments[0] == 'newnote':
            if onb:
                if len(arguments) == 1:
                    on = nb.note()

                elif len(arguments) == 2:
                    on = nb.note(title=arguments[1])

                elif len(arguments) == 3:
                    on = nb.note(title=arguments[1], node=onb.title)

            else:
                print('No Notebook Opened open a notebook first')

        if arguments[0] == 'h' or arguments[0] == 'help':
            print(manual)
        if arguments[0] == 'q' or arguments[0] == 'quit':
            quit()
Example #3
0
def initialize():
    'This fxn initializes app, loads all the notebooks'
    # load json data for notebooks
    global jd
    jd = open('data.json', 'r')
    for ntb in jd.readlines():
        jntb = json.loads(ntb)
        append_ntb = nb.notebook(jntb['title'])
        append_ntb.notelist = jntb['notelist']
        notebooks.append(append_ntb)
Example #4
0
	def __init__(self, parent=None):
		''' The constructor.
		'''
		Tkinter.Tk.__init__(self, parent)
		self._parent = parent
		self.title('Client')

		# building menu
		self._menu = Tkinter.Menu(self)
		self.config(menu=self._menu)

		self._file_menu = Tkinter.Menu(self._menu)
		self._menu.add_cascade(label='File', menu=self._file_menu)
		self._file_menu.add_command(label='Exit', command=self._exit)

		# building content
		self._notebook = notebook(self, Tkinter.TOP)

		self._log = Log(self._notebook())
		self._notebook.add_screen(self._log, "Log")

		self._contacts = Contacts(self._notebook())
		self._notebook.add_screen(self._contacts, "Contacts")
Example #5
0
import notebook as nb
import json

data = open("data.json", 'r+')

notebook = nb.notebook()

notes = json.load(data)
Example #6
0
 def body(self, parent):
     import notebook
     notebook = notebook.notebook(parent, side=TOP)
     for group in self.opts:
         tab = Frame(notebook())
         for optnumber, option in enumerate(group):
             optf = Frame(tab)
             label = Label(optf, text=getPrettyName(option))
             label.pack(fill=Y, side=LEFT)
             if option.type in ('String', 'Integer', 'Password'):
                 if option.type == 'Password':
                     edit = Entry(optf, show='*')
                 else:
                     edit = Entry(optf)
                 val = option.getValue()
                 if val and val is not NoDefaultOption:
                     edit.insert(0, str(val))
                 edit.pack(fill=BOTH, side=RIGHT)
                 get = edit.get
                 edit = (optf, label, edit)
             elif option.type == 'Choice':
                 rbf = Frame(optf)
                 buttons = []
                 name = option.name
                 val = option.value
                 self.choiceoptions[name] = val
                 for c in [x.value for x in option]:
                     if c == val:
                         E = 1
                     else:
                         E = 0
                     b = Radiobutton(rbf,
                                     text=c,
                                     indicatoron=1,
                                     variable=self.choiceoptions[name],
                                     value=c,
                                     command=lambda o=self.choiceoptions, n=
                                     name, c=c: o.__setitem__(n, c))
                     if E:
                         b.select()
                     else:
                         b.deselect()
                     b.pack(side=LEFT)
                     buttons.append(b)
                 rbf.pack(side=RIGHT, fill=BOTH)
                 get = lambda opt=name: self.choiceoptions[opt]
                 edit = (rbf, buttons)
             elif option.optionType == 'Boolean':
                 name = option.name
                 val = option.value
                 self.booloptions[name] = val
                 b = Checkbutton(optf,
                                 variable=self.booloptions[name],
                                 command=lambda o=self.booloptions, n=name:
                                 o.__setitem__(n, not o[n]))
                 b.pack(side=RIGHT, fill=BOTH)
                 edit = b
                 get = lambda opt=name: self.booloptions[opt]
             else:
                 raise ValueError, "unknown option type %s" % (
                     option.optionType)
             optf.pack(fill=X, side=TOP, ipady=4)
             if edit is not None:
                 self.options[option.name] = (option.type, get, edit)
         notebook.add_screen(tab, group.name)
     return notebook()
Example #7
0
        log.delete(1.0, 2.0)
    if log.index('end-1c') != '1.0':
        log.insert('end', '\n')
    log.insert('end', msg)
    log.see(END)
    log['state'] = 'disabled'


SECTION_BACKGROUND = "#9DE7A0"
SUBSECTION_BACKGROUND = "#DAE2C1"

root = Tk()
app = FullScreenApp(root)
root.wm_title("HAH - House Automation Hub")
n = notebook(root,
             LEFT,
             select_bg=SECTION_BACKGROUND,
             select_color=SECTION_BACKGROUND)

update_ip_btn = Button(root,
                       text="Update IP",
                       command=lambda: writeToLog("Server IP set to: " +
                                                  update_ip(ip_entry.get())),
                       pady=5)
update_ip_btn.pack(fill=BOTH, side=BOTTOM)

ip_entry = Entry(root, bd=5)
ip_entry.pack(fill=BOTH, side=BOTTOM)

n_f1 = Frame(n())
n_f2 = Frame(n())
Example #8
0
 def btnGunKaydet(self, widget):
     gunLabel = self.builder.get_object("label6")
     notebook().writeProgram(self.builder, gunLabel.get_text())
Example #9
0
 def btnDayOnClick(self, widget):
     self.program.hide()
     self.programDay.show()
     self.builder.get_object("label6").set_text(widget.get_label())
     notebook().readProgram(self.builder, widget.get_label())