Beispiel #1
0
	def __init__(self, app):

		gtk.Window.__init__(self)
		self.app = app

		vbox = gtk.VBox(False, 0)

		self.mb = AppMenubar(self)
		vbox.pack_start(self.mb, False, False, 0)

		self.toolbar = AppToolbar(self)
		vbox.pack_start(self.toolbar, False, False, 0)

		#---CENTRAL PART
		hpaned = gtk.HPaned()
		hpaned.set_border_width(2)

		self.nb_frame = gtk.EventBox()
		self.nb_splash = SplashArea(self)
		hpaned.pack1(self.nb_frame, True, True)

		self.nb = gtk.Notebook()
		self.nb_frame.add(self.nb_splash)
		self.nb.connect('switch-page', self.change_doc)
		self.nb.set_property('scrollable', True)

		self.tools_frame = gtk.VBox(False, 0)
		self.tools = AppTools(self)
		self.tools.set_size_request(200, -1)
		self.tools_frame.pack_end(self.tools, expand=True)
		hpaned.pack2(self.tools_frame, True, False)
		hpaned.set_position(1000)

		vbox.pack_start(hpaned , True, True, 2)
		#---CENTRAL PART END



		self.statusbar = AppStatusbar(self)
		vbox.pack_end(self.statusbar, expand=False)

		self.add(vbox)
		self.set_win_title()
		self.set_size_request(config.mw_min_width, config.mw_min_height)
		self.set_default_size(config.mw_width, config.mw_height)
		self.set_position(gtk.WIN_POS_CENTER)
		self.connect("delete-event", self.exit)
		self.add_accel_group(self.app.accelgroup)
		icon = os.path.join(config.resource_dir, 'app_icon.png')
		self.set_icon_from_file(icon)
		self.show_all()
		if config.mw_maximized:
			self.window.maximize()
Beispiel #2
0
    def __init__(self, app):

        gtk.Window.__init__(self)
        self.app = app

        vbox = gtk.VBox(False, 0)

        self.mb = AppMenubar(self)
        vbox.pack_start(self.mb, False, False, 0)

        self.toolbar = AppToolbar(self)
        vbox.pack_start(self.toolbar, False, False, 0)

        # ---CENTRAL PART
        hpaned = gtk.HPaned()
        hpaned.set_border_width(2)

        self.nb_frame = gtk.EventBox()
        self.nb_splash = SplashArea(self)
        hpaned.pack1(self.nb_frame, True, True)

        self.nb = gtk.Notebook()
        self.nb_frame.add(self.nb_splash)
        self.nb.connect("switch-page", self.change_doc)
        self.nb.set_property("scrollable", True)

        self.tools_frame = gtk.VBox(False, 0)
        self.tools = AppTools(self)
        self.tools.set_size_request(200, -1)
        self.tools_frame.pack_end(self.tools, expand=True)
        hpaned.pack2(self.tools_frame, True, False)
        hpaned.set_position(1000)

        vbox.pack_start(hpaned, True, True, 2)
        # ---CENTRAL PART END

        self.statusbar = AppStatusbar(self)
        vbox.pack_end(self.statusbar, expand=False)

        self.add(vbox)
        self.set_win_title()
        self.set_size_request(config.mw_min_width, config.mw_min_height)
        self.set_default_size(config.mw_width, config.mw_height)
        self.set_position(gtk.WIN_POS_CENTER)
        self.connect("delete-event", self.exit)
        self.add_accel_group(self.app.accelgroup)
        icon = os.path.join(config.resource_dir, "app_icon.png")
        self.set_icon_from_file(icon)
        self.show_all()
        if config.mw_maximized:
            self.window.maximize()
Beispiel #3
0
class MainWindow(gtk.Window):
    def __init__(self, app):

        gtk.Window.__init__(self)
        self.app = app

        vbox = gtk.VBox(False, 0)

        self.toolbar = AppToolbar(self)
        vbox.pack_start(self.toolbar, False, False, 0)

        # ---CENTRAL PART
        hpaned = gtk.HPaned()
        hpaned.set_border_width(0)

        self.nb_frame = gtk.EventBox()
        self.nb_splash = SplashArea(self)
        hpaned.pack1(self.nb_frame, True, True)

        self.nb = gtk.Notebook()
        self.nb_frame.add(self.nb_splash)
        self.nb.connect('switch-page', self.change_doc)
        self.nb.set_property('scrollable', True)
        # self.nb.set_tab_reorderable(True)
        self.nb.set_show_border(False)

        self.tools_frame = gtk.VBox(False, 0)
        self.tools = AppTools(self)
        self.tools.set_size_request(200, -1)
        self.tools_frame.pack_end(self.tools, expand=True)
        hpaned.pack2(self.tools_frame, True, False)
        hpaned.set_position(1000)

        vbox.pack_start(hpaned, True, True, 0)
        # ---CENTRAL PART END

        self.add(vbox)
        self.set_win_title()
        self.set_size_request(config.mw_min_width, config.mw_min_height)
        self.set_default_size(config.mw_width, config.mw_height)
        self.set_position(gtk.WIN_POS_CENTER)
        self.connect("delete-event", self.exit)
        self.add_accel_group(self.app.accelgroup)
        icon = os.path.join(config.resource_dir, 'app_icon.png')
        self.set_icon_from_file(icon)
        self.show_all()
        if config.mw_maximized:
            self.window.maximize()

    def set_win_title(self, docname=''):
        if docname:
            title = '%s - %s' % (docname, self.app.appdata.app_name)
            self.set_title(title)
        else:
            self.set_title(self.app.appdata.app_name)

    def exit(self, *args):
        if self.app.exit():
            return False
        else:
            return True

    def add_tab(self, da):
        if not self.nb.get_n_pages():
            self.nb_frame.remove(self.nb_splash)
            self.nb_frame.add(self.nb)
        index = self.nb.append_page(da, da.tab_caption)
        da.show_all()
        self.nb.show_all()
        self.nb.set_current_page(index)
        self.set_win_title(da.presenter.doc_name)

    def remove_tab(self, tab):
        self.nb.remove_page(self.nb.page_num(tab))
        if not self.nb.get_n_pages():
            self.nb_frame.remove(self.nb)
            self.nb_frame.add(self.nb_splash)
            self.set_win_title()
            self.app.current_doc = None

    def change_doc(self, *args):
        da = self.nb.get_nth_page(args[2])
        self.app.current_doc = da.presenter
        self.set_win_title(da.caption)
        events.emit(events.DOC_CHANGED, self)

    def set_tab_title(self, tab, title):
        tab.set_caption(title)
        if self.nb.page_num(tab) == self.nb.get_current_page():
            self.set_win_title(title)

    def set_active_tab(self, tab):
        self.nb.set_current_page(self.nb.page_num(tab))
Beispiel #4
0
class MainWindow(gtk.Window):
    def __init__(self, app):

        gtk.Window.__init__(self)
        self.app = app

        vbox = gtk.VBox(False, 0)

        self.mb = AppMenubar(self)
        vbox.pack_start(self.mb, False, False, 0)

        self.toolbar = AppToolbar(self)
        vbox.pack_start(self.toolbar, False, False, 0)

        # ---CENTRAL PART
        hpaned = gtk.HPaned()
        hpaned.set_border_width(2)

        self.nb_frame = gtk.EventBox()
        self.nb_splash = SplashArea(self)
        hpaned.pack1(self.nb_frame, True, True)

        self.nb = gtk.Notebook()
        self.nb_frame.add(self.nb_splash)
        self.nb.connect("switch-page", self.change_doc)
        self.nb.set_property("scrollable", True)

        self.tools_frame = gtk.VBox(False, 0)
        self.tools = AppTools(self)
        self.tools.set_size_request(200, -1)
        self.tools_frame.pack_end(self.tools, expand=True)
        hpaned.pack2(self.tools_frame, True, False)
        hpaned.set_position(1000)

        vbox.pack_start(hpaned, True, True, 2)
        # ---CENTRAL PART END

        self.statusbar = AppStatusbar(self)
        vbox.pack_end(self.statusbar, expand=False)

        self.add(vbox)
        self.set_win_title()
        self.set_size_request(config.mw_min_width, config.mw_min_height)
        self.set_default_size(config.mw_width, config.mw_height)
        self.set_position(gtk.WIN_POS_CENTER)
        self.connect("delete-event", self.exit)
        self.add_accel_group(self.app.accelgroup)
        icon = os.path.join(config.resource_dir, "app_icon.png")
        self.set_icon_from_file(icon)
        self.show_all()
        if config.mw_maximized:
            self.window.maximize()

    def set_win_title(self, docname=""):
        if docname:
            title = "%s - %s" % (docname, self.app.appdata.app_name)
            self.set_title(title)
        else:
            self.set_title(self.app.appdata.app_name)

    def exit(self, *args):
        if self.app.exit():
            return False
        else:
            return True

    def add_tab(self, da):
        if not self.nb.get_n_pages():
            self.nb_frame.remove(self.nb_splash)
            self.nb_frame.add(self.nb)
        index = self.nb.append_page(da, da.tab_caption)
        da.show_all()
        self.nb.show_all()
        self.nb.set_current_page(index)
        self.set_win_title(da.presenter.doc_name)

    def remove_tab(self, tab):
        self.nb.remove_page(self.nb.page_num(tab))
        if not self.nb.get_n_pages():
            self.nb_frame.remove(self.nb)
            self.nb_frame.add(self.nb_splash)
            self.set_win_title()
            self.app.current_doc = None

    def change_doc(self, *args):
        da = self.nb.get_nth_page(args[2])
        self.app.current_doc = da.presenter
        self.set_win_title(da.caption)
        events.emit(events.DOC_CHANGED, self)

    def set_tab_title(self, tab, title):
        tab.set_caption(title)
        if self.nb.page_num(tab) == self.nb.get_current_page():
            self.set_win_title(title)

    def set_active_tab(self, tab):
        self.nb.set_current_page(self.nb.page_num(tab))