sexta-feira, 6 de novembro de 2009

Plugins GIMP e DIA no launchpad

Acabo de colocar no LaunchPad (http://www.launchpad.net/axplugins), o código dos plugins do GIMP e do DIA já comentados neste blog.

O código está disponível para download por desenvolvedores, mas ainda não está pronto para um "release" aberto.

Os principais aspectos que faltam para este release são:

  • Documentação (readme, comentários no código)
  • Referências de copyright e licença (GPL-V2) no código
  • Instruções de instalação
  • "Limpeza" geral do código

Quem tiver interesse em colaborar, por favor entre em contato.

terça-feira, 8 de setembro de 2009

Convites SoLiSC

Acontece em novembro de 2009, em Floripa, o 4º Congresso SoLiSC (Congresso Catarinense de Software Livre).

Verdadeiras "lendas" da comunidade de Software Livre estarão por lá... vale a pena dar uma olhada no site:

http://www.solisc.org.br

Só para dar uma palhinha de quem vai estar lá, olha quem está convidando para o evento:





segunda-feira, 3 de agosto de 2009

Plugin DIA para redimensionar objetos

Para quem não conhece, o Dia é uma aplicação muito interessante para desenho de diagramas.

Este projeto parece estar um pouco "devagar" ultimamente, mas é extremamente útil.

Usando esta ferramenta por estes dias, senti falta de uma funcionalidade: selecionar um grupo de objetos e redimensioná-los para um tamanho específico. No espírito do Software livre, implementei esta funcionalidade como um plugin em python, e posto o código aqui (é bem curto) para aqueles que tiverem interesse.

Ainda é uma versão experimental, mas, assim que eu achar que isto está mais ou menos estável, vou encaminhar para o pessoal do projeto Dia como sugestão para inclusão na distribuição.
Até lá, quem quiser experimentar (por sua própria conta e risco...), fique à vontade.

A maneira mais simples de instalar é criar, dentro do seu diretório ".dia", um diretório python, e salvar o arquivo lá (sugiro o nome de objresize.py). Na próxima vez que você carregar o Dia, vai encontrar, no menu Objetos, o item "Simple Resize Selected". É só selecionar um ou mais objetos e executar esta função, que você verá um diálogo perguntando as dimensões dos objetos, e todos os objetos serão redimensionados para o tamanho especificado.

Código:


1 # PyDia Simple Resize
2 # -*- coding:utf-8 -*-
3 # Copyright (c) 2009, Alexandre Machado <axmachado@gmail.com>
4 #
5 # Resize selected Objects via property api
6 #
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 1 of the License or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 import dia
23
24 def resizeSelected (w,h):
25 """ Do the resize job: resize all selected
26 objects to the width and heigth expressed
27 by "
w" and "h" parameters """
28
29 activeDiagram = dia.active_display().diagram
30 for elem in activeDiagram.selected:
31 if elem.properties.has_key('elem_width'):
32 elem.properties['elem_width'] = w
33 if elem.properties.has_key('elem_height'):
34 elem.properties['elem_height' ] = h
35
36 dia.update_all()
37
38
39 # GTK stuff
40 import pygtk
41 pygtk.require("2.0")
42 import gtk
43
44 class MessageBox:
45 def __init__(self, msg = 'Message here',
46
title = ''):
47 self.dlg = gtk.Dialog (title, flags=gtk.DIALOG_MODAL)
48 lbl = gtk.Label (msg)
49 self.dlg.vbox.pack_start(lbl, True, True, 2)
50 lbl.show()
51
52 btn = gtk.Button("Ok", gtk.STOCK_OK)
53 btn.connect("clicked", self.close)
54 self.dlg.action_area.pack_start(btn)
55 btn.show()
56
57 self.dlg.show()
58
59 def close(self, widget, data=None):
60
self.dlg.destroy()
61
62
63
64 class ResizeWindow:
65 """
66 Window class to get the parameters
67 "
""
68
69 def __init__(self):
70
self.initWindow()
71 self.window.show()
72
73 def checkDelete(self, widget, data=None):
74
return False;
75
76 def destroy(self, widget, data=None):
77
self.window.destroy()
78
79 def close(self, widget, data=None):
80
self.window.destroy()
81
82 def doResize(self,widget,data=None):
83
try:
84 w = float(self.iw.get_text())
85 h = float(self.ih.get_text())
86 resizeSelected(w,h)
87 except ValueError,v:
88 MessageBox("The values for width and height must be valid numbers",
89 "Invalid data")
90
91 def initWindow(self):
92
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
93 self.window.set_title("Simple Resize")
94 self.window.set_border_width(3)
95
96 l1 = gtk.Label("Width:")
97 l1.show()
98 l2 = gtk.Label("Height:")
99 l2.show()
100 self.iw = gtk.Entry()
101 self.iw.set_text('1.0')
102 self.iw.show()
103 self.ih = gtk.Entry()
104 self.ih.set_text('1.0')
105 self.ih.show()
106
107 btnGo = gtk.Button("Resize")
108 btnGo.show()
109 btnClose = gtk.Button("Close");
110 btnClose.show()
111
112 box1 = gtk.VBox(False,2)
113 box1.show()
114 box2 = gtk.HBox(False,2)
115 box2.show()
116 box3 = gtk.HBox(False,2)
117 box3.show()
118 box4 = gtk.HBox(False,2)
119 box4.show()
120
121 box1.pack_start(box2)
122 box1.pack_start(box3)
123 box1.pack_start(box4)
124
125 box2.pack_end(self.iw);
126 box2.pack_end(l1);
127
128 box3.pack_end(self.ih);
129 box3.pack_end(l2);
130
131 box4.pack_start(btnGo);
132 box4.pack_start(btnClose)
133 self.window.add(box1)
134
135 btnGo.connect("clicked", self.doResize)
136 btnClose.connect("clicked", self.close)
137 self.window.connect("delete_event", self.checkDelete)
138 self.window.connect("destroy", self.destroy)
139
140 def resize_cb(data,flags):
141 dlg = ResizeWindow()
142
143 dia.register_action ("ObjectSimpleresizeSelected", "Simple Resize Selected",
144 "/DisplayMenu/Objects/ObjectsExtensionStart",
145 resize_cb)

syntax highlighted by Code2HTML, v. 0.9.1

quinta-feira, 2 de julho de 2009

Emfim, um começo

Este blog nasce como uma resposta a uma pergunta que uma amiga me fez: "você anota todas estas idéias que você tem?"

Esta pergunta, aparentemente inocente, me faz pensar: eu realmente tenho as idéias? Alguém consegue, efetivamente, ter uma idéia, ser dono dela e controlá-la, ou elas tem vida própria?

Com estas perguntas na cabeça, resolvi começar a anotar as idéias que me passam pela cabeça, e, ao anotá-las publicamente, deixá-las soltas por aí, livres para encontrarem outras idéias, ganhando forma e força neste processo.

Bem vindo(a)