def __init__(self,application,parent=None): super(MainWindow,self).__init__(parent) #private attributes self.menuBar_ = QMenuBar() self.fileMenu_ = FileMenu(self) self.editMenu_ = EditMenu(self) self.toolbarDoc_ = QDockWidget(self) self.toolbarWidget_ = Toolbar(self) self.setGeometry(0,0,1280,720) #public attributes self.application = application self.contentTab = ContentTab() self.statusBar = QStatusBar() #menuBar self.menuBar_.addMenu(self.fileMenu_) self.menuBar_.addMenu(self.editMenu_) self.menuBar_.addAction("Help",self.helpFunc) self.setMenuBar(self.menuBar_) #statusBar self.statusBar.showMessage("status bar") self.setStatusBar(self.statusBar) #toolBar self.toolbarDoc_.setFeatures(QDockWidget.NoDockWidgetFeatures ) self.addDockWidget(Qt.LeftDockWidgetArea,self.toolbarDoc_) self.toolbarDoc_.setWidget(self.toolbarWidget_) #contentab self.setCentralWidget(self.contentTab)
def __init__(self): gtk.EventBox.__init__(self) self.vbox = gtk.VBox() self.toolbar = Toolbar() self.vbox.pack_start(self.toolbar, False, False, 0) self.videoview = VideoView() self.vbox.pack_start(self.videoview, True, True, 0) self.flashcards = FlashCardView() self.vbox.pack_start(self.flashcards, True, True, 0) self.gamemenu = GameMenu() self.vbox.pack_start(self.gamemenu, True, True, 0) self.instructionsview = InstructionsView() self.vbox.pack_start(self.instructionsview, True, True, 0) self.welcomeview = WelcomeView() self.vbox.pack_start(self.welcomeview, True, True, 0) self.creditsview = CreditsView() self.vbox.pack_start(self.creditsview, True, True, 0) self.add(self.vbox) self.show_all() self.toolbar.connect("activar", self.__switch) self.toolbar.connect("video", self.__play_video) self.gamemenu.gameview.connect("video", self.__game_return_to_video) self.gamemenu.connect("video", self.__game_return_to_video) self.videoview.connect("flashcards", self.__play_flashcards) self.videoview.connect("game", self.__play_game) self.flashcards.connect("video", self.__game_return_to_video) self.welcomeview.connect("instructions", self.__play_instructions) self.welcomeview.connect("credits", self.__play_credits) self.welcomeview.connect("start", self.__show_menu) self.connect("delete-event", self.__salir) self.toolbar.menubutton.connect("toggled", self.__stop_credits) self.toolbar.homebutton.set_active(True) self.__switch(False, "Home", None)
def __init__(self, master): self.master = master self.master.title('Könyvtár') self.master.option_add('*tearOff', False) self.frames = {'left': Frame(master), 'right': Frame(master)} # Load Software Icons Icon.create() # Initialize Dropdown Menus DropdownMenus(self, master) # Initialize Toolbar Toolbar(self, master)
def add_toolbar(self): Toolbar(frame=self.__frame, canvas=self.__canvas)
class Main(gtk.EventBox): def __init__(self): gtk.EventBox.__init__(self) self.vbox = gtk.VBox() self.toolbar = Toolbar() self.vbox.pack_start(self.toolbar, False, False, 0) self.videoview = VideoView() self.vbox.pack_start(self.videoview, True, True, 0) self.flashcards = FlashCardView() self.vbox.pack_start(self.flashcards, True, True, 0) self.gamemenu = GameMenu() self.vbox.pack_start(self.gamemenu, True, True, 0) self.instructionsview = InstructionsView() self.vbox.pack_start(self.instructionsview, True, True, 0) self.welcomeview = WelcomeView() self.vbox.pack_start(self.welcomeview, True, True, 0) self.creditsview = CreditsView() self.vbox.pack_start(self.creditsview, True, True, 0) self.add(self.vbox) self.show_all() self.toolbar.connect("activar", self.__switch) self.toolbar.connect("video", self.__play_video) self.gamemenu.gameview.connect("video", self.__game_return_to_video) self.gamemenu.connect("video", self.__game_return_to_video) self.videoview.connect("flashcards", self.__play_flashcards) self.videoview.connect("game", self.__play_game) self.flashcards.connect("video", self.__game_return_to_video) self.welcomeview.connect("instructions", self.__play_instructions) self.welcomeview.connect("credits", self.__play_credits) self.welcomeview.connect("start", self.__show_menu) self.connect("delete-event", self.__salir) self.toolbar.menubutton.connect("toggled", self.__stop_credits) self.toolbar.homebutton.set_active(True) self.__switch(False, "Home", None) def __stop_credits(self, widget): if self.creditsview.props.visible: run = not bool(self.creditsview.visor.update) if run: self.creditsview.visor.modify_bg( gtk.STATE_NORMAL, COLORES["text"]) self.creditsview.visor.new_handle(run) def __game_return_to_video(self, widget, topic): self.__play_video(widget, topic) #self.videoview.videoplayer.stop() def __play_game(self, widget, topic): self.__switch(False, "game", topic) def __play_flashcards(self, widget, data): self.__switch(False, "flashcards", data) def __play_video(self, widget, topic): self.toolbar.homebutton.set_active(False) self.__switch(False, "Topics", topic) self.videoview.set_full(False) #self.videoview.videoplayer.pause() def __play_instructions(self, widget): self.__switch(False, "Instructions") self.toolbar.homebutton.set_active(False) def __play_credits(self, widget): self.__switch(False, "Credits") self.toolbar.homebutton.set_active(False) def __show_menu(self, widget): self.toolbar.menubutton.popup() self.toolbar.menubutton.set_active(True) self.toolbar.instructionsbutton.set_active(False) def __switch(self, widget, label, data=False): map(ocultar, self.vbox.get_children()[1:]) if label == "Home": self.welcomeview.run() elif label == "Instructions": self.instructionsview.run() elif label == "Credits": self.creditsview.run() elif label == "Topics": self.videoview.run(data) elif label == "flashcards": self.flashcards.run(data) elif label == "game": self.gamemenu.run(data) return False def __salir(self, widget=None, senial=None): self.videoview.stop() gtk.main_quit() sys.exit(0)
def __init__(self, editor): from Toolbar import Toolbar Toolbar(editor) from ToolbarVisibility.Manager import Manager Manager(editor)
def __init__( self, user, rate_plan, notebooks, notebook, parent_id=None, login_url=None, logout_url=None, startup_notes=None, total_notes_count=None, notes=None, note_read_write=True, start=None, count=None, http_url=None, conversion=None, rename=False, deleted_id=None, invites=None, invite_id=None, after_login=None, signup_plan=None, signup_yearly=None, recent_notes=None, groups=None, ): startup_note_ids = [ startup_note.object_id for startup_note in startup_notes ] def note_controls(note, read_write): read_write_access = ( read_write == Notebook.READ_WRITE ) or \ ( read_write == Notebook.READ_WRITE_FOR_OWN_NOTES and note.user_id == user.object_id ) return Div( read_write_access and Input( type = "button", class_ = "note_button", id = "delete_note_%s" % note.object_id, value = "delete" + ( note.deleted_from_id and " forever" or "" ), title = "delete note [ctrl-d]" ) or None, read_write_access and note.deleted_from_id and Input( type = "button", class_ = "note_button", id = "undelete_note_%s" % note.object_id, value = "undelete", title = "undelete note" ) or None, ( read_write == Notebook.READ_WRITE ) and not note.deleted_from_id and Input( type = "button", class_ = "note_button", id = "changes_note_%s" % note.object_id, value = "changes", title = "previous revisions", ) or None, ( read_write == Notebook.READ_WRITE ) and not note.deleted_from_id and Input( type = "button", class_ = "note_button", id = "tools_note_%s" % note.object_id, value = "tools", title = "note tools", ) or None, ( read_write != Notebook.READ_ONLY or not note.startup ) and not note.deleted_from_id and \ ( read_write != Notebook.READ_WRITE_FOR_OWN_NOTES ) and Input( type = "button", class_ = "note_button", id = "hide_note_%s" % note.object_id, value = "hide", title = "hide note [ctrl-h]", ) or None, id = u"note_controls_%s" % note.object_id, class_ = u"note_controls", ) def static_note_divs(notes, read_write): return [ Table( Tr(Td(note_controls(note, read_write), )), Tr( Td( Div( Span( note.contents, class_=u"static_note_contents", separator="", ), id="static_note_%s" % note.object_id, class_=u"static_note_div", ), width="100%", ), Td( u".....", id=u"note_grabber_%s" % note.object_id, class_=u"note_grabber" + (read_write != Notebook.READ_WRITE and " invisible" or ""), ), ), Tr( Td( Div(class_="note_shadow_corner"), id=u"note_shadow_%s" % note.object_id, class_=u"note_shadow undisplayed", ), ), id=u"note_holder_%s" % note.object_id, class_=u"note_holder", ) for note in notes ] static_notes = notes and static_note_divs( notes, note_read_write and notebook.read_write or Notebook.READ_ONLY ) or \ static_note_divs( startup_notes, notebook.read_write ) # Since the contents of these notes are included in the static_notes section below, don't # include them again in the hidden fields here. Accomplish this by making custom dicts for # sending to the client. startup_note_dicts = [{ u"object_id": startup_note.object_id, u"revision": startup_note.revision, u"deleted_from_id": startup_note.deleted_from_id, u"user_id": startup_note.user_id, u"username": startup_note.username, } for startup_note in startup_notes] note_dicts = [{ u"object_id": note.object_id, u"revision": note.revision, u"deleted_from_id": note.deleted_from_id, u"user_id": note.user_id, u"username": note.username, u"creation": note.creation, } for note in notes] root_notes = startup_notes + (notes and [ note for note in notes if note.object_id not in startup_note_ids ] or []) def json(string): return escape(unicode(Json(string)), quote=True) if len(notes) == 1: title = notes[0].title else: title = notebook.name if rate_plan.get(u"notebook_sharing"): updates_path = u"/notebooks/updates/%s?rss&%s" % ( notebook.object_id, urlencode([(u"notebook_name", notebook.name.encode("utf8"))]), ) else: updates_path = None forum_tags = [tag for tag in notebook.tags if tag.name == u"forum"] forum_tag = None if notebook.name == u"Luminotes": notebook_path = u"/" updates_path = None # no RSS feed for the main notebook elif notebook.name == u"Luminotes user guide": notebook_path = u"/guide" elif forum_tags: forum_tag = forum_tags[0] if forum_tag.value == u"blog": notebook_path = u"/blog/%s" % notebook.friendly_id else: notebook_path = u"/forums/%s/%s" % (forum_tag.value, notebook.object_id) else: notebook_path = u"/notebooks/%s" % notebook.object_id conversion_js = None if conversion: try: conversion_js = file(u"static/js/%s_conversion.js" % conversion).read() except IOError: pass if notebook.read_write == Notebook.READ_WRITE: header_note_title = u"wiki" else: all_notes = startup_notes + notes header_note_title = ( notebook.name == "Luminotes" ) and all_notes and all_notes[0].title or notebook.name header_note_title = { "contact info": "contact", "meet the team": "team", "Luminotes user guide": "guide", "Luminotes privacy policy": "privacy", }.get(header_note_title, header_note_title) own_notebooks = [ nb for nb in notebooks if nb.read_write == Notebook.READ_WRITE ] header_notebook = own_notebooks and own_notebooks[0] or notebook Page.__init__( self, title, Link( rel = u"stylesheet", type = u"text/css", href = u"/static/css/header.css?%s" % VERSION ), updates_path and \ Link( rel = u"alternate", type = u"application/rss+xml", title = notebook.name, href = updates_path ) or None, Script( type = u"text/javascript", src = u"/static/js/MochiKit.js?%s" % VERSION ) or None, Script( type = u"text/javascript", src = u"/static/js/Invoker.js?%s" % VERSION ) or None, Script( type = u"text/javascript", src = u"/static/js/Editor.js?%s" % VERSION ) or None, Script( type = u"text/javascript", src = u"/static/js/Wiki.js?%s" % VERSION ) or None, Input( type = u"hidden", name = u"user", id = u"user", value = json( user ) ), Input( type = u"hidden", name = u"rate_plan", id = u"rate_plan", value = json( rate_plan ) ), Input( type = u"hidden", name = u"yearly", id = u"yearly", value = json( signup_yearly ) ), Input( type = u"hidden", name = u"notebooks", id = u"notebooks", value = json( notebooks ) ), Input( type = u"hidden", name = u"notebook", id = u"notebook", value = json( notebook ) ), Input( type = u"hidden", name = u"parent_id", id = u"parent_id", value = parent_id or "" ), Input( type = u"hidden", name = u"startup_notes", id = u"startup_notes", value = json( startup_note_dicts ) ), Input( type = u"hidden", name = u"current_notes", id = u"current_notes", value = json( note_dicts ) ), Input( type = u"hidden", name = u"note_read_write", id = u"note_read_write", value = json( note_read_write ) ), Input( type = u"hidden", name = u"rename", id = u"rename", value = json( rename ) ), Input( type = u"hidden", name = u"deleted_id", id = u"deleted_id", value = deleted_id ), Input( type = u"hidden", name = u"invites", id = u"invites", value = json( invites ) ), Input( type = u"hidden", name = u"invite_id", id = u"invite_id", value = invite_id ), Input( type = u"hidden", name = u"after_login", id = u"after_login", value = after_login ), Input( type = u"hidden", name = u"signup_plan", id = u"signup_plan", value = signup_plan ), Input( type = u"hidden", name = u"groups", id = u"groups", value = json( groups ) ), Div( id = u"status_area", ), Header( user, header_notebook, login_url, logout_url, header_note_title, rate_plan ), Div( Div( Link_area( Toolbar( notebook, hide_toolbar = parent_id or notebook.read_write == Notebook.READ_ONLY, note_word = forum_tag and u"post" or u"note", ), notebooks, notebook, parent_id, notebook_path, updates_path, user, rate_plan, ), id = u"left_area", ), Div( ( notebook.read_write != Notebook.READ_ONLY ) and Noscript( P( Strong( u""" Luminotes requires JavaScript to be enabled in your web browser in order to edit your wiki. Please <a href="/enable_javascript">enable JavaScript</a> before continuing. """ ) ), ) or None, Rounded_div( ( notebook.name == u"trash" ) and u"trash_notebook" or u"current_notebook", parent_id and Span( A( u"empty", href = u"/notebooks/%s" % notebook.object_id, id = u"empty_trash_link" ), u" | ", A( u"go back", href = u"/notebooks/%s" % parent_id ), id = u"notebook_header_links", ) or None, ( notebook.name == u"Luminotes" and title == u"source code" ) and \ Strong( "%s %s" % ( notebook.name, VERSION ) ) or \ Span( ( notebook.name == u"trash" or notebook.read_write != Notebook.READ_WRITE ) \ and Strong( notebook.name ) \ or Span( Strong( notebook.name ), id = u"notebook_header_name", title = "Rename this notebook." ), ), id = u"notebook_header_area", corners = ( u"tl", u"tr", u"br" ), ), Div( Rounded_div( ( notebook.name == u"trash" ) and u"trash_notebook_inner" or u"current_notebook_inner", Div( id = u"deleted_notebooks", ), Page_navigation( notebook_path, len( notes ), total_notes_count, start, count, ), Div( Span( id = u"notes_top" ), static_notes, id = u"notes", ), ( notebook.read_write == Notebook.READ_WRITE ) and Div( id = u"blank_note_stub", class_ = u"blank_note_stub_hidden_border", ) or None, ( forum_tag and user.username and user.username != u"anonymous" ) and \ Span( ( forum_tag.value == "blog" ) and P( u"To write a comment, click that large \"+\" button to the left. To publish your comment, click the save button.", class_ = u"small_text" ) or P( u"To write a comment, click that large \"+\" button to the left. To publish your comment, click the save button. Or, ", A( u"start a new discussion", href = u"/forums/%s/create_thread" % forum_tag.value ), u".", separator = "", class_ = u"small_text" ), ) or None, ( forum_tag and ( not user.username or user.username == u"anonymous" ) ) and \ P( u"To write a comment, please login first. No account?", A( u"Sign up", href = u"/pricing" ), u"to get a free account.", class_ = "small_text" ) or None, Page_navigation( notebook_path, len( notes ), total_notes_count, start, count, return_text = u"return to the discussion", ), Div( id = u"iframe_area", ), id = u"notebook_background", corners = ( u"tl", ), ), id = u"notebook_border", class_ = ( notebook.name == u"trash" ) and u"trash_notebook_color" or u"current_notebook_color", ), id = u"center_content_area", ), Div( Note_tree_area( notebook, root_notes, recent_notes, total_notes_count, user, ), id = u"right_area", ), id = u"everything_area", ), Span( id = "grabber_hover_preload" ), )
def createWindowLayout(): global root, center, body, left, right, header, footer, canvas, listbox global scale, fileRot, mouseRect, mouseRectColor, mouseLabel, uvColor defaultbg = root.cget('bg') debug = False root.grid_columnconfigure(0, weight=1) root.grid_rowconfigure(0, weight=0) root.grid_rowconfigure(1, weight=1) root.grid_rowconfigure(2, weight=0) root.bind("<Motion>", root_movemouse) header = tkinter.Frame(root, bg="yellow" if debug else defaultbg, padx=4, pady=4) header.name = "header" header.grid(column=0, row=0, sticky="nesw") center = tkinter.Frame(root, bg="magenta2" if debug else defaultbg, padx=4, pady=4) center.name = "center" center.grid(column=0, row=1, sticky="nesw") footer = tkinter.Frame(root, bg="yellow" if debug else defaultbg) footer.name = "footer" footer.grid(column=0, row=2, sticky="nesw") center.grid_columnconfigure(0, weight=0) center.grid_columnconfigure(1, weight=1) center.grid_columnconfigure(2, weight=0) center.grid_rowconfigure(0, weight=1) #left = tkinter.Frame(center,width=32,bg='green' if debug else defaultbg) #left = tkinter.Listbox(center,width=20,bg='green' if debug else defaultbg) left = tkinter.Frame(center, bg='green' if debug else defaultbg) scrollbar = tkinter.Scrollbar(left, orient=tkinter.VERTICAL) listbox = tkinter.Listbox(left, yscrollcommand=scrollbar.set) scrollbar.config(command=listbox.yview) scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y) listbox.pack(side=tkinter.LEFT, fill=tkinter.BOTH, expand=1) left.name = 'left' left.grid(column=0, row=0, sticky="nsw", padx=(0, 4)) listbox.bind("<<ListboxSelect>>", listbox_select) middle = tkinter.Canvas(center, cursor='dot', width=int(2560 * scale), height=int(1440 * scale), bg=uvColor) middle.name = 'middle' middle.grid(column=1, row=0, sticky="nsew") canvas = middle canvas.bind("<Button-1>", canvas_clickLeft) canvas.bind("<Button-3>", canvas_clickRight) canvas.bind("<Motion>", canvas_movemouse) mouseRect = canvas.create_rectangle(0, 0, 0, 0, fill='', outline=mouseRectColor) mouseLabel = canvas.create_text(0, 0, anchor="nw", text=str(fileRot), font="Times 12 bold", fill=uvColor) right = tkinter.Frame(center, width=32, bg='green' if debug else defaultbg) right.name = 'right' right.grid(column=2, row=0, sticky="nse", padx=(4, 8)) # Toolbar tbEdit = Toolbar(header, orientation=tkinter.HORIZONTAL, btnSize=24) tbEdit.grid(column=0, row=0, sticky="wns") tbEdit.add_command(os.path.join(installpath, "new.png"), "New", mnNew) tbEdit.add_command(os.path.join(installpath, "load.png"), "Load", mnLoad) tbEdit.add_command(os.path.join(installpath, "save.png"), "Save", mnSaveAs) #Props global entry_BottomLayers, entry_BottomExp, entry_NormalExp, entry_Offtime, label_layerHeight right.columnconfigure(0, weight=0) right.columnconfigure(1, weight=1) #Bottom props propLabel = tkinter.Label(right, text="Bottom", font=('Helvetica', 11, 'bold')) #,bg=col) propLabel.grid(row=0, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) propLabel = tkinter.Label(right, text=" # Layers", font=('Helvetica', 11, '')) #,bg=col) propLabel.grid(row=1, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) entry_BottomLayers = tkinter.Entry(right, width=6, highlightcolor='blue') entry_BottomLayers.grid(row=1, column=1, padx=0, pady=0, sticky=tkinter.W + tkinter.W) propLabel = tkinter.Label(right, text=" Exp Time", font=('Helvetica', 11, '')) #,bg=col) propLabel.grid(row=2, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) entry_BottomExp = tkinter.Entry(right, width=6, highlightcolor='blue') entry_BottomExp.grid(row=2, column=1, padx=0, pady=0, sticky=tkinter.W + tkinter.W) # sep propLabel = tkinter.Label(right, text=" ", font=('Helvetica', 11, 'bold')) #,bg=col) propLabel.grid(row=3, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) #Normal props propLabel = tkinter.Label(right, text="Normal", font=('Helvetica', 11, 'bold')) #,bg=col) propLabel.grid(row=4, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) propLabel = tkinter.Label(right, text=" Exp Time", font=('Helvetica', 11, '')) #,bg=col) propLabel.grid(row=5, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) entry_NormalExp = tkinter.Entry(right, width=6, highlightcolor='blue') entry_NormalExp.grid(row=5, column=1, padx=0, pady=0, sticky=tkinter.W + tkinter.W) propLabel = tkinter.Label(right, text=" Off Time", font=('Helvetica', 11, '')) #,bg=col) propLabel.grid(row=6, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) entry_Offtime = tkinter.Entry(right, width=6, highlightcolor='blue') entry_Offtime.grid(row=6, column=1, padx=0, pady=0, sticky=tkinter.W + tkinter.W) # sep propLabel = tkinter.Label(right, text=" ", font=('Helvetica', 11, 'bold')) #,bg=col) propLabel.grid(row=7, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) #LayerHeight propLabel = tkinter.Label(right, text="Layer Height", font=('Helvetica', 11, 'bold')) #,bg=col) propLabel.grid(row=8, column=0, padx=0, pady=0, sticky=tkinter.W + tkinter.W) label_layerHeight = tkinter.Label(right, text=" 0.5", font=('Helvetica', 11, '')) #,bg=col) label_layerHeight.grid(row=9, column=1, padx=0, pady=0, sticky=tkinter.W + tkinter.W)