From 18019ab53d9dea5d5402a19a59f1868bc3a7dcda Mon Sep 17 00:00:00 2001 From: Alexandre Antonino Gonçalves Martinazzo Date: Mon, 08 Oct 2007 21:44:11 +0000 Subject: Fitting canvas to usable area (See ticket #3689) --- diff --git a/Area.py b/Area.py index 936ed10..031d7c7 100644 --- a/Area.py +++ b/Area.py @@ -82,7 +82,8 @@ class Area(gtk.DrawingArea): logging.debug('Area.__init__(self, janela)') gtk.DrawingArea.__init__(self) - self.set_size_request(800, 600) + #self.set_size_request(800, 600) + self.set_size_request(1185, 770) self.set_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_PRESS_MASK | @@ -519,8 +520,8 @@ class Area(gtk.DrawingArea): self.undo_surf = True - #special case for func polygon - if self.tool['name'] == 'polygon': + #special case for func polygon + if self.tool['name'] == 'polygon': self.polygon_start = True #start the polygon again @@ -586,7 +587,7 @@ class Area(gtk.DrawingArea): @param self -- the Area object (GtkDrawingArea) """ clipBoard = gtk.Clipboard() - tempPath = os.path.join("/tmp", "tempFile") + tempPath = os.path.join("/tmp", "tempFile") tempPath = os.path.abspath(tempPath) if self.selmove: @@ -614,7 +615,7 @@ class Area(gtk.DrawingArea): else : logging.debug('Area.copy(self): Please select some area first') - + def _copyGetFunc( self, clipboard, selection_data, info, data ): """ Determine type data to put in clipboard @@ -623,7 +624,7 @@ class Area(gtk.DrawingArea): @param selection_data -- data of selection @param info -- the application assigned integer associated with a target @param data -- user data (tempPath) - """ + """ selection_data.set( "text/uri-list", 8, data) def _copyClearFunc( self, clipboard, data ): @@ -632,12 +633,12 @@ class Area(gtk.DrawingArea): @param self -- the Area object (GtkDrawingArea) @param clipboard -- a gtk.Clipboard object @param data -- user data (tempPath) - """ - if (data != None): - if (os.path.exists(data)): - os.remove( data ) - data = None - + """ + if (data != None): + if (os.path.exists(data)): + os.remove( data ) + data = None + def past(self): """ Past image. Past image that is in pixmap @@ -646,7 +647,7 @@ class Area(gtk.DrawingArea): """ width, height = self.window.get_size() - tempPath = os.path.join("/tmp", "tempFile") + tempPath = os.path.join("/tmp", "tempFile") tempPath = os.path.abspath(tempPath) clipBoard = gtk.Clipboard() diff --git a/Desenho.py b/Desenho.py index c2f2018..e7ad7e1 100644 --- a/Desenho.py +++ b/Desenho.py @@ -158,17 +158,17 @@ class Desenho: """ colormap = widget.get_colormap() - rainbow_colors = [ - colormap.alloc_color('#ff0000', True, True), # vermelho - colormap.alloc_color('#ff8000', True, True), # laranja - colormap.alloc_color('#ffff00', True, True), # amarelo + rainbow_colors = [ + colormap.alloc_color('#ff0000', True, True), # vermelho + colormap.alloc_color('#ff8000', True, True), # laranja + colormap.alloc_color('#ffff00', True, True), # amarelo colormap.alloc_color('#80ff00', True, True), # verde lima - colormap.alloc_color('#00ff00', True, True), # verde + colormap.alloc_color('#00ff00', True, True), # verde colormap.alloc_color('#00ff80', True, True), # verde agua colormap.alloc_color('#00ffff', True, True), # azul claro colormap.alloc_color('#007fff', True, True), # quase azul - colormap.alloc_color('#0000ff', True, True), # azul - colormap.alloc_color('#8000ff', True, True), # anil + colormap.alloc_color('#0000ff', True, True), # azul + colormap.alloc_color('#8000ff', True, True), # anil colormap.alloc_color('#ff00ff', True, True), # rosa violeta colormap.alloc_color('#ff0080', True, True), # violeta ] @@ -525,9 +525,9 @@ class Desenho: if widget.estadoTexto == 0: widget.estadoTexto = 1 - widget.janela.fixed.move(widget.janela.textview, int(event.x)+200, int(event.y)+100) + #widget.janela.fixed.move(widget.janela.textview, int(event.x)+200, int(event.y)+100) # Area size has changed... - #widget.janela.fixed.move(widget.janela.textview, int(event.x), int(event.y)) + widget.janela.fixed.move(widget.janela.textview, int(event.x), int(event.y)) widget.janela.textview.show() widget.janela.textview.grab_focus() @@ -686,7 +686,7 @@ class Desenho: try: self.resize_pixbuf except: - self.resize_pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, w, h) + self.resize_pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, w, h) self.resize_pixbuf.get_from_drawable(widget.pixmap, gtk.gdk.colormap_get_system(), x0, y0, 0, 0, int(w), int(h)) x0,y0 = self.coords @@ -702,7 +702,7 @@ class Desenho: widget.pixmap_temp.draw_drawable(widget.gc, widget.pixmap_sel,0,0,0,0, width, height) - #to draw the selection black and white line rectangle + #to draw the selection black and white line rectangle widget.pixmap_sel.draw_rectangle(widget.gc_selection, False ,x0- delta_x -1, y0- delta_y-1,int(width_percent*w+1), int(height_percent*h+1)) widget.pixmap_sel.draw_rectangle(widget.gc_selection1, False ,x0- delta_x -2, y0- delta_y-2,int(width_percent*w +1), int(height_percent*h +1)) diff --git a/NEWS b/NEWS index 1e63800..866b603 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* Drawing area now fits usable area (alexandre) + 11 * Bug #3749 fixed; resuming from Journal is working again (alexandre) diff --git a/OficinaActivity.py b/OficinaActivity.py index ace8e12..a77381d 100644 --- a/OficinaActivity.py +++ b/OficinaActivity.py @@ -65,9 +65,7 @@ from Area import Area import logging class OficinaActivity(activity.Activity): - def oficina(self, widget, data=None): - logging.info('Oficina') - + def __init__(self, handle): """Initialize the OficinaActivity object. @@ -99,18 +97,18 @@ class OficinaActivity(activity.Activity): color = gtk.gdk.color_parse("white") self.fixed.modify_bg(gtk.STATE_NORMAL, color) - self._bg = gtk.Image() - self._bg.set_from_file('./icons/bg.svg') - self.fixed.put(self._bg, 200, 100) - self._bg.show + #self._bg = gtk.Image() + #self._bg.set_from_file('./icons/bg.svg') + #self.fixed.put(self._bg, 200, 100) + #self._bg.show self.textview = gtk.TextView() # If we use this, text viewer will have constant size, we don't want that #self.textview.set_size_request(100,100) - self.fixed.put(self.area, 200 , 100) + #self.fixed.put(self.area, 200 , 100) # Area size increased - #self.fixed.put(self.area, 0 , 0) + self.fixed.put(self.area, 0 , 0) sw.add_with_viewport(self.fixed) self.area.show() -- cgit v0.9.1