sandip chitale's blog    Sandip Chitale's blog (scblog)
NOTE: I have moved many of my modules to NetBeans Plugin Portal . Please check there for latest versions of modules described on this blog.
20070825 Saturday August 25, 2007

Copy Path in Nautilus

I recently switched to Ubuntu. Starting to like it.

Here is my first Ubuntu/Nautilus hack. Put the following python script:

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk
import os

# get the clipboard
clipboard = gtk.clipboard_get()

# set the clipboard text data
clipboard.set_text(os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'])

# make our data available to other applications
clipboard.store()

in the file:

~/.gnome2/nautilus-scripts/Copy Path

Now launch Nautilus, select any file(s) or folder(s) and invoke pop up menu  and select Scripts:Copy Path. The fully qualified path(s) of the file(s) or folder(s) will be copied to the clipboard.

Does anyone know a better way?


Posted by sandipchitale ( Aug 25 2007, 12:15:00 PM PDT ) Permalink Comments [3]


20070807 Tuesday August 07, 2007

BorderLayout implemented in terms of GroupLayout

Just for fun. Here is a java.awt.BorderLayout implemented in terms of javax.swing.GroupLayout:

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class BorderLayoutGroupLayout {
    public static void main(String[] args) {
        JButton west = new JButton("West");
        JButton north = new JButton("North");
        JButton east = new JButton("East");
        JButton south = new JButton("South");
        JButton center = new JButton("Center");
       
        JPanel panel = new JPanel();
        GroupLayout groupLayout = new GroupLayout(panel);
        panel.setLayout(groupLayout);
       
        groupLayout.setHorizontalGroup(
            groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(north, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(groupLayout.createSequentialGroup()
                    .addComponent(west)
                    .addComponent(center, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(east))
                .addComponent(south, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        groupLayout.setVerticalGroup(
            groupLayout.createSequentialGroup()
                .addComponent(north)
                .addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(west, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(center, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(east, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addComponent(south)               
        );
        JDialog dialog = new JDialog((JFrame)null, "", true);
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setContentPane(panel);
        dialog.pack();
        dialog.setVisible(true);
    }
}


Posted by sandipchitale ( Aug 07 2007, 02:47:08 PM PDT ) Permalink Comments [0]










« August 2007 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
26
27
28
29
30
31
 
       
Today

Get NetBeans 5.5

Locations of visitors to this page

Today's Page Hits: 109


XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

scblog
scblog