23 agosto 2006
error en clipboard
me dice que WaitIsImageAvailable() no esta en el espacio de nombres de Gtk.Clipboard y tambien clip.WaitForImage() no se encuentra, pero el caso de que tengo instalado Mono-1.1.16.1 tanto en Linux como en Windows, pero en Windows no existe error alguno, pero en linux me da estos 2 errores, por lo que por el momento la funcion de pegado de imagen en minis solo estara disponible en windows (que mala pata) y en linux pues buscare como arreglarlo, pero si alguien sabe que pasa y se anima a iluminarme lo agradecere en grande.
He retirado la encuesta
14 agosto 2006
Mejoras en minis-0.0.1
descargar minis-0.0.1
Este es el codigo anexado
public void on_bPegar_clicked(System.Object b, EventArgs e)
{
Gtk.Clipboard clip = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
//Se verifica que el contenido del portapapeles sea una imagen valida
if(clip.WaitIsImageAvailable() == true)
{
Gdk.Pixbuf ImagenScreen = clip.WaitForImage();
ImagenScreen.Save("screen.jpg","jpeg");
NombreImagen = "screen.jpg";
Gdk.Pixbuf escalar;
escalar = ImagenScreen.ScaleSimple (460, 380, Gdk.InterpType.Hyper);
ImagenActual.Pixbuf = escalar;
ImagenMiniatura.Pixbuf = Thumbnail(NombreImagen, Ancho.ValueAsInt, Alto.ValueAsInt);
}
else
mensaje("El Portapapeles no contiene una imagen valida!", MessageType.Warning);
}
Aqui la pantalla del cambio y nueva imagen
13 agosto 2006
minis-0.0.1 gtksharp-2.0
Aclaracion: el codigo mostrado anteriormente se puede compilar con gtk-sharp inferior a 2.0
El codigo aqui disponible para su descarga es para compilarse con gtksharp 2.8.3
Requerimientos:
mono-1.1.16.1
gtk-sharp-2.8.3
descargar minis-0.0.1
Mas informacion de minis
12 agosto 2006
Minis-0.0.1
Lenguaje utilizado: c#
Entorno de desarrollo: Mono 1.1.12

Aqui dejo el codigo
//------------------------------------------------------------------------------------------------------------------
// Proyecto: Convertidor de Imagenes a tamaño miniatura (thumbnails)
// Desarrollo: gsur
// Fecha: 12/08/2006
// Compilar:
// mcs minis.cs AcercaDe.cs -out:minis.exe -pkg:gtk-sharp -pkg:glade-sharp -resource:minis-0.0.1.glade;acercade.glade
// Entorno de desarrollo: Mono
//blog: http://gsur.blogspot.com
//------------------------------------------------------------------------------------------------------------------
using System;
using Gtk;
using Glade;
public class minis
{
[Glade.Widget] Gtk.Window window;
[Glade.Widget] Gtk.SpinButton Ancho;
[Glade.Widget] Gtk.SpinButton Alto;
[Glade.Widget] Gtk.Image ImagenActual;
[Glade.Widget] Gtk.Image ImagenMiniatura;
static FileSelection filew;
static string tipo;
string NombreImagen;
public static void Main(String[] args)
{
Application.Init();
minis prog = new minis();
prog.muestra();
}
public minis()
{
Glade.XML gxml=new Glade.XML(null, "minis-0.0.1.glade","window",null);
gxml.Autoconnect(this);
window.Icon = new Gdk.Pixbuf("minisico.png");
NombreImagen="";
tipo = "jpeg";
}
public void muestra()
{
Application.Run();
}
public void on_window_delete_event(object o, DeleteEventArgs args)
{
Application.Quit();
}
public void on_bSalir_clicked(System.Object b, EventArgs e)
{
Application.Quit();
}
public void on_bAbrir_clicked(System.Object b, EventArgs e)
{
filew = new FileSelection("Archivo de Imagen");
filew.HideFileopButtons ();
filew.Filename = NombreImagen;
ResponseType r = (ResponseType) filew.Run();
if(r == ResponseType.Ok)
{
try
{
NombreImagen = filew.Filename;
ImagenActual.Pixbuf = Thumbnail(filew.Filename, 640, 480);
ImagenMiniatura.Pixbuf = Thumbnail(NombreImagen, Ancho.ValueAsInt, Alto.ValueAsInt);
filew.Destroy();
}
catch(Exception error)
{
Console.WriteLine(error);
}
filew.Destroy();
}
else
filew.Destroy();
}
public void on_bGuardar_clicked(System.Object b, EventArgs e)
{
String msg;
Gtk.FileSelection fileg = new FileSelection("Guardar Miniatura como");
fileg.HideFileopButtons ();
fileg.SetResponseSensitive(ResponseType.Ok,false);
fileg.AddButton(Stock.Save,ResponseType.Ok);
fileg.Filename = NombreImagen;
fileg.Icon= new Gdk.Pixbuf("minisico.png");
ResponseType r = (ResponseType) fileg.Run();
if(r == ResponseType.Ok)
{
if(Guardar(fileg.Filename))
{
msg="\n\nSe ha guardado la miniatura";
mensaje(msg, MessageType.Info);
}
else
{
msg="\n\nOcurrio Error al guardar!";
mensaje(msg, MessageType.Warning);
}
fileg.Destroy();
}
else
fileg.Destroy();
}
public void on_bAplicar_clicked(System.Object b, EventArgs e)
{
if(NombreImagen == "")
mensaje("Debe abrir una imagen valida!", MessageType.Warning);
else
ImagenMiniatura.Pixbuf = Thumbnail(NombreImagen, Ancho.ValueAsInt, Alto.ValueAsInt);
}
public void on_bAcerca_clicked(System.Object b, EventArgs e)
{
new AcercaDe();
}
Gdk.Pixbuf Thumbnail(string nombre, int ancho, int alto)
{
Gdk.Pixbuf p = new Gdk.Pixbuf(nombre);
Gdk.Pixbuf thumb;
thumb = p.ScaleSimple(ancho, alto, Gdk.InterpType.Hyper);
return thumb;
}
void mensaje(string mensaje, MessageType MensajeTipo)
{
MessageDialog md = new MessageDialog(
window,
DialogFlags.DestroyWithParent,
MensajeTipo,
ButtonsType.Ok,
mensaje);
ResponseType rok = (ResponseType) md.Run();
if(rok == ResponseType.Ok)
{
md.Destroy();
}
}
bool Guardar(string NombreGuardar)
{
try
{
Gdk.Pixbuf temp;
temp = ImagenMiniatura.Pixbuf;
temp.Savev(NombreGuardar + "." + tipo,tipo,null,null);
return true;
}
catch(Exception e)
{
return false;
}
}
public void on_opjpg_toggled(System.Object b, EventArgs e)
{
tipo = "jpeg";
}
public void on_oppng_toggled(System.Object b, EventArgs e)
{
tipo = "png";
}
}
05 agosto 2006
Thumbnails con Mono - C# y Gtk
Este codigo lo puedes utilizar y claro no olviden mencionar a gsur como su autor
//mcs -pkg:gtk-sharp dbimagen.cs
//mono dbimagen.exe
using Gtk;
using System.IO;
public class dbimagen
{
public static void Main()
{
Gtk.Application.Init();
new dbimagen();
Gtk.Application.Run();
}
static Gtk.TreeView tree;
static Gtk.Entry EntradaFolder;
static Gtk.Entry ancho;
static Gtk.Entry alto;
static FileSelection filew;
static Gtk.Entry EntradaThumb;
static Gtk.ListStore ImagenLista;
public dbimagen()
{
//Creacion de ventana
Gtk.Window window = new Gtk.Window("Generador de Thumbnails ver. 0.1");
window.SetSizeRequest(600, 400);
window.DeleteEvent+=new DeleteEventHandler(Window_Delete);
EntradaFolder = new Gtk.Entry();
Gtk.Label lblFolder = new Gtk.Label("Folder: ");
Gtk.HBox BoxSup = new Gtk.HBox();
Gtk.Button bexaminar = new Gtk.Button(Stock.Open);
bexaminar.Clicked += OnButtonClicked;
Gtk.Button bcargar = new Gtk.Button(Stock.Ok);
bcargar.Clicked += OnBCargarClicked;
Gtk.Label lblancho = new Gtk.Label("Ancho: ");
Gtk.Label lblalto = new Gtk.Label("Alto: ");
ancho = new Gtk.Entry("75");
alto = new Gtk.Entry("50");
BoxSup.PackStart(lblFolder, false, false, 5);
BoxSup.PackStart(EntradaFolder, false, false, 5);
BoxSup.PackStart(bexaminar, false, false, 5);
BoxSup.PackStart(bcargar, false, false, 5);
BoxSup.PackStart(lblancho, false, false, 5);
BoxSup.PackStart(ancho, true, true, 5);
BoxSup.PackStart(lblalto, false, false, 5);
BoxSup.PackStart(alto, true, true, 5);
//Creacion del Treeview donde se mostrara informacion de la imagen
tree = new Gtk.TreeView();
Gtk.VBox box = new Gtk.VBox();
box.PackStart(BoxSup, false, false, 5);
ScrolledWindow scrolledWindow = new ScrolledWindow ();
scrolledWindow.ShadowType = ShadowType.EtchedIn;
scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
scrolledWindow.Add(tree);
box.PackStart (scrolledWindow, true, true, 5);
Gtk.HBox boxinf= new Gtk.HBox();
Gtk.Label lblnthumb = new Gtk.Label("Thumbnail Seleccionado ");
EntradaThumb = new Gtk.Entry();
Gtk.Button bguardar = new Gtk.Button(Stock.Save);
boxinf.PackStart(lblnthumb, false, false, 5);
boxinf.PackStart(EntradaThumb, false, false, 5);
boxinf.PackStart(bguardar, false, false, 5);
box.PackStart(boxinf, false, false, 5);
//Lo agregamos a la ventana
window.Add(box);
//Agregamos las columnas al Treeview
tree.AppendColumn("Miniatura",new Gtk.CellRendererPixbuf(),"pixbuf",0);
Gtk.TreeViewColumn NombreImagenColumna = new Gtk.TreeViewColumn();
NombreImagenColumna.Title = "Nombre de la Imagen";
Gtk.CellRendererText NombreImagenCelda = new Gtk.CellRendererText();
NombreImagenColumna.PackStart(NombreImagenCelda,true);
tree.AppendColumn(NombreImagenColumna.Title, new Gtk.CellRendererText(),"text",1);
tree.AppendColumn("Tipo",new Gtk.CellRendererText(),"text",2);
window.ShowAll();
}
static void OnBCargarClicked(object o, EventArgs args)
{
ImagenLista = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string));
string ndir = EntradaFolder.Text;
string nombreima;
DirectoryInfo dir = new DirectoryInfo(ndir);
FileInfo[] archivos = dir.GetFiles();
for(int i = 0; i < nombreima =" ndir" model =" ImagenLista;" twidth =" Convert.ToInt32(ancho.Text);" theight =" Convert.ToInt32(alto.Text);" pb =" new" thumb =" pb.ScaleSimple" retval="true;" filew =" new" filename = "" text =" filew.Filename;">
03 agosto 2006
Mis playeras mono y gnome (1)
20 junio 2006
Que mas queda
18 junio 2006
Mi blog
08 junio 2006
Atenderemos peticiones
07 junio 2006
Solo en México?
31 mayo 2006
Almacenamiento de conocimiento
30 mayo 2006
Conversor numero a letras con c# (1)
Aqui la pantalla

Y aqui les dejo el codigo, espero sus comentarios y claro sus ideas para mejorar este programita, que quizas sencillo, pero a veces muy util cuando tienes que elaborarte un presupuestillo y necesitas poner la cantidad en letra.
using System;
using Gtk;
class nletras
{
static Gtk.Window w;
static Gtk.Entry tcantidad;
static Gtk.Entry tresultado;
static Gtk.Button bconvertir;
static Gtk.Button bsalir;
static String UnoAl15(double N)
{
String[] numero = new String[17];
numero[0] = "CERO ";
numero[1] = "UN ";
numero[2] = "DOS ";
numero[3] = "TRES ";
numero[4] = "CUATRO ";
numero[5] = "CINCO ";
numero[6] = "SEIS ";
numero[7] = "SIETE ";
numero[8] = "OCHO ";
numero[9] = "NUEVE ";
numero[10] = "DIEZ ";
numero[11] = "ONCE ";
numero[12] = "DOCE ";
numero[13] = "TRECE ";
numero[14] = "CATORCE ";
numero[15] = "QUINCE ";
return numero[Convert.ToInt32(N)];
}
static void Main()
{
Application.Init();
w = new Gtk.Window("Convierte numero a letras");
w.SetDefaultSize(450,150);
w.DeleteEvent += new DeleteEventHandler(Cerrar);
Gtk.VBox panelv = new Gtk.VBox();
Gtk.HBox panelsup = new Gtk.HBox(false, 5);
panelv.PackStart(panelsup,false, false, 5);
Gtk.Label lbl1 = new Gtk.Label("Cantidad en numero ");
tcantidad = new Gtk.Entry();
bconvertir = new Button("Convertir a letras");
bconvertir.Clicked += OnButtonClickedConvertir;
panelsup.PackStart(lbl1, false, false, 5);
panelsup.PackStart(tcantidad, false, false, 5);
panelsup.PackStart(bconvertir, false, false, 5);
Gtk.Label lbl2 = new Gtk.Label("Numero en letra ");
tresultado = new Gtk.Entry();
Gtk.HBox panelres = new Gtk.HBox(false, 5);
panelv.PackStart(panelres, false, false, 5);
panelres.PackStart(lbl2, false, false, 5);
panelres.PackStart(tresultado, true, true, 5);
bsalir = new Button(Stock.Quit);
bsalir.Clicked += OnButtonClicked;
panelv.PackStart(bsalir, false, false, 5);
w.Add(panelv);
w.ShowAll();
Application.Run();
}
static void Cerrar(object o, DeleteEventArgs args)
{
args.RetVal = true;
Application.Quit();
}
static void OnButtonClicked(object o, EventArgs args)
{
Application.Quit();
}
static void OnButtonClickedConvertir(object o, EventArgs args)
{
String aux = UnoAl15(Convert.ToDouble(tcantidad.Text));
tresultado.Text = aux;
}
}
27 mayo 2006
Ya tengo algo
26 mayo 2006
Avances lentos
25 mayo 2006
Un intruso sospechoso
24 mayo 2006
Desarrollo de software en México
12 mayo 2006
Cambiando de distro Linux
using System;
using Gtk;
class miventana
{
static void Main(String[] args)
{
Application.Quit();
Window v = new Window("Mi ventana");
v.ShowAll();
Application.Init();
}
}
Mucho ojo el codigo esta mal! jejeje




