コード例 #1
0
    def __init__(self, name='HandleToolbar'):
        HandleBox.__init__(self)
        self.set_name(name)
        self.toolbar = Toolbar()
        self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(TOOLBAR_TEXT)
        self.toolbar.set_border_width(3)
        self.add(self.toolbar)

        self.toolbar.show()
        self.show()
コード例 #2
0
 def __init__(self, name='HandleToolbar'):
     HandleBox.__init__(self)
     self.set_name(name)
     self.toolbar = Toolbar()
     self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
     self.toolbar.set_style(TOOLBAR_TEXT)
     self.toolbar.set_border_width(3)
     self.add(self.toolbar)
     
     self.toolbar.show()
     self.show()
コード例 #3
0
ファイル: Toolbar.py プロジェクト: mystilleef/scribes
class Toolbar(object):

	def __init__(self, editor):
		self.__init_attributes(editor)
		self.__set_properties()
		self.__add_toolbuttons()
		self.__sigid1 = editor.connect("quit", self.__quit_cb)
		editor.register_object(self)

	def __init_attributes(self, editor):
		self.__editor = editor
		from gtk import Toolbar
		self.__toolbar = Toolbar()
		return

	def __destroy(self):
		self.__editor.disconnect_signal(self.__sigid1, self.__editor)
		self.__editor.unregister_object(self)
		del self
		return

	def __set_properties(self):
		from Utils import never_focus
		never_focus(self.__toolbar)
		self.__toolbar.set_property("sensitive", True)
		from gtk import TEXT_WINDOW_WIDGET, ORIENTATION_HORIZONTAL, EventBox
		from gtk import TOOLBAR_ICONS, Frame, SHADOW_IN, ICON_SIZE_SMALL_TOOLBAR
		self.__toolbar.set_property("icon-size", ICON_SIZE_SMALL_TOOLBAR)
		self.__toolbar.set_style(TOOLBAR_ICONS)
		self.__toolbar.set_orientation(ORIENTATION_HORIZONTAL)
		self.__editor.set_data("Toolbar", self.__toolbar)
		frame = Frame()
		frame.add(self.__toolbar)
		frame.set_shadow_type(SHADOW_IN)
		box = EventBox()
		box.add(frame)
		self.__editor.set_data("ToolContainer", box)
		self.__editor.textview.add_child_in_window(box, TEXT_WINDOW_WIDGET, -3, -3)
		return

	def __add_toolbuttons(self):
		from ToolbuttonsInitializer import Initializer
		Initializer(self.__toolbar, self.__editor)
		return

	def __quit_cb(self, *args):
		self.__destroy()
		return False
コード例 #4
0
class Toolbar(object):
    def __init__(self, editor):
        self.__init_attributes(editor)
        self.__set_properties()
        self.__add_toolbuttons()
        self.__sigid1 = editor.connect("quit", self.__quit_cb)
        editor.register_object(self)

    def __init_attributes(self, editor):
        self.__editor = editor
        from gtk import Toolbar
        self.__toolbar = Toolbar()
        return

    def __destroy(self):
        self.__editor.disconnect_signal(self.__sigid1, self.__editor)
        self.__editor.unregister_object(self)
        del self
        return

    def __set_properties(self):
        from Utils import never_focus
        never_focus(self.__toolbar)
        self.__toolbar.set_property("sensitive", True)
        from gtk import TEXT_WINDOW_WIDGET, ORIENTATION_HORIZONTAL, EventBox
        from gtk import TOOLBAR_ICONS, Frame, SHADOW_IN, ICON_SIZE_SMALL_TOOLBAR
        self.__toolbar.set_property("icon-size", ICON_SIZE_SMALL_TOOLBAR)
        self.__toolbar.set_style(TOOLBAR_ICONS)
        self.__toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.__editor.set_data("Toolbar", self.__toolbar)
        frame = Frame()
        frame.add(self.__toolbar)
        frame.set_shadow_type(SHADOW_IN)
        box = EventBox()
        box.add(frame)
        self.__editor.set_data("ToolContainer", box)
        self.__editor.textview.add_child_in_window(box, TEXT_WINDOW_WIDGET, -3,
                                                   -3)
        return

    def __add_toolbuttons(self):
        from ToolbuttonsInitializer import Initializer
        Initializer(self.__toolbar, self.__editor)
        return

    def __quit_cb(self, *args):
        self.__destroy()
        return False
コード例 #5
0
ファイル: Toolbar.py プロジェクト: mystilleef/scribes
	def __init_attributes(self, editor):
		self.__editor = editor
		from gtk import Toolbar
		self.__toolbar = Toolbar()
		return
コード例 #6
0
class HandleToolbar(HandleBox):
    def __init__(self, name='HandleToolbar'):
        HandleBox.__init__(self)
        self.set_name(name)
        self.toolbar = Toolbar()
        self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(TOOLBAR_TEXT)
        self.toolbar.set_border_width(3)
        self.add(self.toolbar)
        
        self.toolbar.show()
        self.show()

    def add_button(self, text, tooltip, function):
        self.toolbar.append_item(text, tooltip, text, None, function, text)

    def set_orientation(self, orientation='horizontal'):
        if orientation == 'horizontal':
            self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        elif orientation == 'vertical':
            self.toolbar.set_orientation(ORIENTATION_VERTICAL)
        else:
            raise Error, 'bad orientation %s' % orientation
コード例 #7
0
    def __init__(self, handle):
        "Set up the activity."

        # Sugar init
        activity.Activity.__init__(self, handle)

        # Create toolbox
        toolbox = activity.ActivityToolbox(self)
        toolbarview = Toolbar()
        tool = ToolButton('zoom-out')
        tool.set_tooltip(_('Zoom out'))
        tool.set_accelerator(_('<ctrl>minus'))
        tool.connect('clicked', self.zoom_out)
        toolbarview.insert(tool, -1)
        tool = ToolButton('zoom-in')
        tool.set_tooltip(_('Zoom in'))
        tool.set_accelerator(_('<ctrl>equal'))
        tool.connect('clicked', self.zoom_in)
        toolbarview.insert(tool, -1)
        toolbox.add_toolbar(_('View'), toolbarview)
        toolbarsample = Toolbar()
        tool = ToolButton('emptytree')
        tool.set_tooltip(_('Empty tree'))
        tool.connect('clicked', self.emptytree)
        toolbarsample.insert(tool, -1)
        tool = ToolButton('sample1')
        tool.set_tooltip(_('Test'))
        tool.connect('clicked', self.sample1)
        toolbarsample.insert(tool, -1)
        tool = ToolButton('sample2')
        tool.set_tooltip(_('Napoléon'))
        tool.connect('clicked', self.sample2)
        toolbarsample.insert(tool, -1)
        toolbox.add_toolbar(_('Samples'), toolbarsample)
        self.set_toolbox(toolbox)
        toolbox.show()

        # Create drawing area
        self.zoomlevel = 0
        self.area = gtk.DrawingArea()
        self.area.set_size_request(875, 780)
        self.area.set_events(gtk.gdk.BUTTON_PRESS_MASK
                             | gtk.gdk.BUTTON_RELEASE_MASK
                             | gtk.gdk.BUTTON_MOTION_MASK
                             | gtk.gdk.POINTER_MOTION_MASK)
        self.area.connect("expose_event", self.area_expose_cb)
        self.area.connect("button_press_event", self.press_button)
        self.area.connect("button_release_event", self.release_button)
        self.area.connect("motion_notify_event", self.mouse_move)
        self.moving = False

        # Create detail view
        self.fixed = VBoxColor(const.bg_color)
        self.fixed.set_size_request(325, 780)
        self.imagezone = gtk.DrawingArea()
        self.imagezone.set_size_request(325, 240)
        self.imagezone.set_events(gtk.gdk.BUTTON_PRESS_MASK
                                  | gtk.gdk.BUTTON_RELEASE_MASK)
        self.imagezone.connect("expose_event", self.image_expose)
        self.imagezone.connect("button_press_event", self.image_release_button)
        self.image_paste = gtk.gdk.pixbuf_new_from_file(
            "images/edit-paste.svg")
        self.image_hand1 = gtk.gdk.pixbuf_new_from_file("images/hand1.png")
        self.fixed.pack_start(self.imagezone, False, False, 0)
        self.detail_name = gtk.Entry()
        self.detail_name.connect("changed", self.detail_changed)
        self.fixed.pack_start(self.detail_name, False, False, 0)
        radiocontainer = gtk.HBox()
        self.detail_chkmale = gtk.RadioButton(None, _("Male"))
        self.detail_chkmale.connect("toggled", self.sexradio_checked, 'M')
        radiocontainer.pack_start(self.detail_chkmale, True, True, 0)
        self.detail_chkfemale = gtk.RadioButton(self.detail_chkmale,
                                                _("Female"))
        self.detail_chkfemale.connect("toggled", self.sexradio_checked, 'F')
        radiocontainer.pack_start(self.detail_chkfemale, True, True, 0)
        self.fixed.pack_start(radiocontainer, False, False, 0)
        scrolled = gtk.ScrolledWindow()
        scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled.set_border_width(2)
        self.detail_description = gtk.TextView()
        self.detail_description.set_wrap_mode(gtk.WRAP_WORD)
        self.detail_description.set_size_request(200, 100)
        self.detail_description.set_cursor_visible(True)
        self.detail_description.get_buffer().connect("changed",
                                                     self.description_changed)
        scrolled.add(self.detail_description)
        self.fixed.pack_start(scrolled, False, False, 5)
        self.detail_btnaddparent = self.create_button(_("Add parents"),
                                                      "images/addparent.svg",
                                                      self.addparent_clicked)
        self.detail_btnaddbrother = self.create_button(
            _("Add brother/sister"), "images/addbrother.svg",
            self.addbrother_clicked)
        self.detail_btnaddunion = self.create_button(_("Add union"),
                                                     "images/addunion.svg",
                                                     self.addunion_clicked)
        self.detail_btnaddchild = self.create_button(_("Add child"),
                                                     "images/addchild.svg",
                                                     self.addchild_clicked)
        self.detail_btndelete = self.create_button(_("Delete"),
                                                   "images/delete.svg",
                                                   self.delete_clicked)
        self.fixed.pack_start(self.detail_btnaddparent, False, False, 2)
        self.fixed.pack_start(self.detail_btnaddunion, False, False, 2)
        self.fixed.pack_start(self.detail_btnaddbrother, False, False, 2)
        self.fixed.pack_start(self.detail_btnaddchild, False, False, 2)
        self.fixed.pack_start(self.detail_btndelete, False, False, 0)
        self.box = gtk.HBox(False)
        self.box.pack_start(self.fixed, True, True, 0)
        self.box.pack_start(self.area, True, True, 0)
        self.set_canvas(self.box)

        # Create empty tree
        self.tree = None
        self.selected = None
        self.init_tree(empty_tree(buddyName))

        # Show all
        self.show_all()
        self.area.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.ARROW))
コード例 #8
0
class HandleToolbar(HandleBox):
    def __init__(self, name='HandleToolbar'):
        HandleBox.__init__(self)
        self.set_name(name)
        self.toolbar = Toolbar()
        self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        self.toolbar.set_style(TOOLBAR_TEXT)
        self.toolbar.set_border_width(3)
        self.add(self.toolbar)

        self.toolbar.show()
        self.show()

    def add_button(self, text, tooltip, function):
        self.toolbar.append_item(text, tooltip, text, None, function, text)

    def set_orientation(self, orientation='horizontal'):
        if orientation == 'horizontal':
            self.toolbar.set_orientation(ORIENTATION_HORIZONTAL)
        elif orientation == 'vertical':
            self.toolbar.set_orientation(ORIENTATION_VERTICAL)
        else:
            raise Error, 'bad orientation %s' % orientation
コード例 #9
0
 def __init_attributes(self, editor):
     self.__editor = editor
     from gtk import Toolbar
     self.__toolbar = Toolbar()
     return