Beispiel #1
0
 def setup_tools(self):
     self.toolbar = ToolFrame(self.master)
     button = ToolImageButton(self.toolbar,
                              label="Send/Recieve",
                              image=self.wrench_icon)
     self.toolbar.insert(button)
     self.toolbar.grid(row=0, column=0, sticky=N + S + E + W)
 def setup_tools(self):
     self.toolbar = ToolFrame(self.master)
     button = ToolImageButton(self.toolbar, label = "Send/Recieve", image = self.wrench_icon);
     self.toolbar.insert(button)
     self.toolbar.grid(row=0, column=0, sticky = N+S+E+W)
Beispiel #3
0
class MainWindow(object):
    def __init__(self, logic):
        self.logic = logic

    def setup_widgets(self):
        """Sets up all the user interface in the main window.
        """

        self.master.title("Email")
        if os.name == "nt":
            self.master.iconbitmap("./icons/Frequency.ico")
        self.dialogs = dialogs.DialogManager(self.master)

        self.master.grid_rowconfigure(1, weight=1)
        self.master.grid_columnconfigure(0, weight=1)
        self.setup_icons()
        self.setup_menus()
        self.setup_tools()
        self.panes = PanedWindow(self.master, orient=HORIZONTAL)
        #TODO Finish the mailbox tree subclass of Treeview.
        self.mailboxTree = Treeview(self.panes, show='tree headings')

        #self.mailboxTree.bind("<<TreeviewSelect>>", self.box_selected)

        self.panes.add(self.mailboxTree)
        self.rightpanes = PanedWindow(self.master, orient=VERTICAL)
        self.messageColumns = ('Subject', 'From', 'To', 'Date')
        self.messageList = Treeview(self.master,
                                    columns=self.messageColumns,
                                    show='headings')
        for heading in self.messageColumns:
            self.messageList.heading(heading, text=heading)
        self.messageList.bind("<<TreeviewSelect>>", self.message_selected)

        self.rightpanes.add(self.messageList)
        self.panes.add(self.rightpanes)
        #self.messageLis
        self.panes.grid(row=1, column=0, sticky=N + S + E + W)
        #self.status.set("Welcome to Frequency!")

    def setup_menus(self):
        self.mainMenu = Menu(self.master)

        self.fileMenu = Menu(self.mainMenu)

        self.newMenu = Menu(self.fileMenu)
        self.newMenu.add_command(label="Message",
                                 command=self.logic.new_message)
        self.fileMenu.add_cascade(label="New", menu=self.newMenu)
        self.fileMenu.add_command(label="Send/Recieve", compound=LEFT)
        self.fileMenu.add_command(label='Options', command=self.logic.options)
        self.fileMenu.add_command(label="Exit", command=self.logic.quit)

        self.mainMenu.add_cascade(label="File", menu=self.fileMenu)

        self.master.config(menu=self.mainMenu)

    def setup_tools(self):
        self.toolbar = ToolFrame(self.master)
        button = ToolImageButton(self.toolbar,
                                 label="Send/Recieve",
                                 image=self.wrench_icon)
        self.toolbar.insert(button)
        self.toolbar.grid(row=0, column=0, sticky=N + S + E + W)

    def message_selected(self, event):
        item = self.messageList.selection()
        index = int(item[0].strip('I')) - 1
        key = self.messageKeys[index]
        displayedMessage = self.inboxes.get_message(key)
        self.mView = messageView.MessageView(self.master)
        self.mView.load_from_message(displayedMessage)

    def setup_icons(self):
        print os.getcwd()
        #self.email_icon = ImageTk.PhotoImage(Image.open('./icons/email.png'))
        #self.email_add_icon = ImageTk.PhotoImage(Image.open('./icons/email_add.png'))
        #self.email_delete_icon = ImageTk.PhotoImage(Image.open('./icons/email_delete.png'))
        #self.email_attach_icon = ImageTk.PhotoImage(Image.open('./icons/email_attach.png'))
        #self.email_edit_icon = ImageTk.PhotoImage(Image.open('./icons/email_edit.png'))
        #self.door_in_icon =  ImageTk.PhotoImage(Image.open('./icons/door_out.png'))
        #self.user_add_icon = ImageTk.PhotoImage(Image.open('./icons/user_add.png'))

        self.wrench_icon = ImageTk.PhotoImage(Image.open("./icons/wrench.png"))

    def quit(self):
        self.master.quit()

    def start(self):
        self.master = Tk()
        self.setup_widgets()
        self.master.mainloop()
        return self
class MainWindow(object):

    def __init__(self, logic):
        self.logic = logic


    def setup_widgets (self):
        """Sets up all the user interface in the main window.
        """
        
        self.master.title("Email")
        if os.name == "nt":
            self.master.iconbitmap("./icons/Frequency.ico")
        self.dialogs = dialogs.DialogManager(self.master)

        
        self.master.grid_rowconfigure(1, weight = 1)
        self.master.grid_columnconfigure(0, weight = 1)
        self.setup_icons()
        self.setup_menus()
        self.setup_tools()
        self.panes = PanedWindow(self.master, orient = HORIZONTAL)
        #TODO Finish the mailbox tree subclass of Treeview.
        self.mailboxTree = Treeview(self.panes,
                                    show = 'tree headings')

        #self.mailboxTree.bind("<<TreeviewSelect>>", self.box_selected)



        self.panes.add(self.mailboxTree)
        self.rightpanes = PanedWindow(self.master, orient = VERTICAL)
        self.messageColumns = ('Subject',
                            'From',
                            'To',
                            'Date')
        self.messageList = Treeview(self.master,
                                    columns = self.messageColumns,
                                    show = 'headings')
        for heading in self.messageColumns:
            self.messageList.heading(heading, text = heading)
        self.messageList.bind("<<TreeviewSelect>>", self.message_selected)


        self.rightpanes.add(self.messageList)
        self.panes.add(self.rightpanes)
        #self.messageLis
        self.panes.grid(row = 1, column = 0, sticky = N+S+E+W)
        #self.status.set("Welcome to Frequency!")
        
    def setup_menus(self):
        self.mainMenu = Menu(self.master)
        
        self.fileMenu = Menu(self.mainMenu)
        
        self.newMenu = Menu(self.fileMenu)
        self.newMenu.add_command(label = "Message", command = self.logic.new_message)
        self.fileMenu.add_cascade(label = "New", menu = self.newMenu)
        self.fileMenu.add_command(label = "Send/Recieve",  compound = LEFT)
        self.fileMenu.add_command(label = 'Options', command = self.logic.options)
        self.fileMenu.add_command(label = "Exit", command = self.logic.quit)
        
        self.mainMenu.add_cascade(label = "File", menu = self.fileMenu)
        
        self.master.config(menu = self.mainMenu)
        
    def setup_tools(self):
        self.toolbar = ToolFrame(self.master)
        button = ToolImageButton(self.toolbar, label = "Send/Recieve", image = self.wrench_icon);
        self.toolbar.insert(button)
        self.toolbar.grid(row=0, column=0, sticky = N+S+E+W)


    def message_selected(self, event):
        item = self.messageList.selection()
        index = int(item[0].strip('I'))-1
        key = self.messageKeys[index]
        displayedMessage = self.inboxes.get_message(key)
        self.mView = messageView.MessageView(self.master)
        self.mView.load_from_message(displayedMessage)



            
    def setup_icons(self):
        print os.getcwd()
        #self.email_icon = ImageTk.PhotoImage(Image.open('./icons/email.png'))
        #self.email_add_icon = ImageTk.PhotoImage(Image.open('./icons/email_add.png'))
        #self.email_delete_icon = ImageTk.PhotoImage(Image.open('./icons/email_delete.png'))
        #self.email_attach_icon = ImageTk.PhotoImage(Image.open('./icons/email_attach.png'))
        #self.email_edit_icon = ImageTk.PhotoImage(Image.open('./icons/email_edit.png'))
        #self.door_in_icon =  ImageTk.PhotoImage(Image.open('./icons/door_out.png'))
        #self.user_add_icon = ImageTk.PhotoImage(Image.open('./icons/user_add.png'))

        self.wrench_icon = ImageTk.PhotoImage(Image.open("./icons/wrench.png"))

    def quit(self):
        self.master.quit()
            
    def start(self):
        self.master = Tk()
        self.setup_widgets()
        self.master.mainloop()
        return self