Esempio n. 1
0
class TestBrowser():
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.path_selected = None
        self.navi = Navigator(self.window)
        self.img = Imager(self.window,400)
        #self.oper = Operator(self.window)
        self.gwydata = GwyData()
        self.channel_img = None
        # widget
        self.window.connect("destroy", lambda w: gtk.main_quit())
        self.window.set_title("TestBrowser")
        self.vbox_main = gtk.VBox(False,0)
        self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
        self.vbox_main.pack_start(self.img.vbox_main,1,1,0)
        #self.vbox_main.pack_start(self.oper.vbox_main,0,1,0)
        self.window.add(self.vbox_main)
        self.window.show_all()
        # Signal handling
        self.navi.combobox_files.connect('changed',self.update_all,None)
        self.img.combobox_channels.connect('changed',self.record_channel,None)
        #self.navi.combobox_files.connect('changed',self.)

    def update_all(self,widget,data):
        self.current_data = self.navi.get_full_path()
        if self.current_data:
            self.gwydata.load_data(self.current_data)
            self.img.initialize(self.gwydata,self.channel_img)

    def record_channel(self,widget,data):
        self.channel_img = self.img.get_active_channel()
Esempio n. 2
0
 def __init__(self):
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.path_selected = None
     self.navi = Navigator(self.window)
     self.img = Imager(self.window,400)
     #self.oper = Operator(self.window)
     self.gwydata = GwyData()
     self.channel_img = None
     # widget
     self.window.connect("destroy", lambda w: gtk.main_quit())
     self.window.set_title("TestBrowser")
     self.vbox_main = gtk.VBox(False,0)
     self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
     self.vbox_main.pack_start(self.img.vbox_main,1,1,0)
     #self.vbox_main.pack_start(self.oper.vbox_main,0,1,0)
     self.window.add(self.vbox_main)
     self.window.show_all()
     # Signal handling
     self.navi.combobox_files.connect('changed',self.update_all,None)
     self.img.combobox_channels.connect('changed',self.record_channel,None)
Esempio n. 3
0
 def __init__(self):
     # Definiton of the variables
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.path_selected = None
     self.navi = Navigator(self.window)
     self.info = Infor(self.window)
     self.oper = Operator(self.window)
     self.gwydata = GwyData()
     self.img_1 = Imager(self.window,400)
     self.img_2 = Imager(self.window,400)
     self.channel_img_1 = None
     self.channel_img_2 = None
     # Definition of the widget
     self.window.connect("destroy", lambda w: gtk.main_quit())
     self.window.set_title("SPMBrowser")
     # vbox_main
     self.vbox_main = gtk.VBox(False,0)
     # hbox_main
     self.hbox_main = gtk.HBox(False,0)
     self.vbox_2 = gtk.VBox(False,0)
     self.hbox_main.pack_start(self.img_1.vbox_main,1,1,0)
     self.hbox_main.pack_start(self.img_2.vbox_main,1,1,0)
     self.vbox_2.pack_start(self.info.table_info,0,1,0)
     self.vbox_2.pack_end(self.oper.vbox_main,0,1,0)
     self.hbox_main.pack_end(self.vbox_2,0,1,0)
     # pack
     self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
     self.vbox_main.pack_start(self.hbox_main,0,1,0)
     self.window.add(self.vbox_main)
     self.window.show_all()
     # Signal handling
     self.navi.combobox_files.connect('changed',self.update_all,None)
     self.img_1.combobox_channels.connect('changed',self.record_channels,None)
     self.img_2.combobox_channels.connect('changed',self.record_channels,None)
     #self.info.entry_ratio.connect('changed',self.update_info,None)
     self.window.connect('key_press_event',self._key_press_event)
Esempio n. 4
0
        self.label_w.set_text("{0:.1f}".format(self.param['width']) +' '+ self.param['xyu']+'['+str(self.param['w_dim'])+']')
        self.label_h.set_text("{0:.1f}".format(self.param['height']) +' '+ self.param['xyu']+'['+str(self.param['h_dim'])+']')
        self.label_w_real.set_text("{0:.1f}".format(self.param['width_real']) +' '+ self.param['xyu'])
        self.label_h_real.set_text("{0:.1f}".format(self.param['height_real']) +' '+ self.param['xyu'])

    def update(self,widget,data):
        ratio = float(self.entry_ratio.get_text())
        print ratio, type(ratio)
        self.param['ratio'] = ratio
        self.param['width_real'] = self.param['width']*ratio
        self.param['height_real'] = self.param['height']*ratio
        self.label_w_real.set_text("{0:.1f}".format(self.param['width_real']) +' '+ self.param['xyu'])
        self.label_h_real.set_text("{0:.1f}".format(self.param['height_real']) +' '+ self.param['xyu'])


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    window = gtk.Window()
    data = GwyData()
    data.load_data('/home/jorghyq/Project/Gwyddion-Utils/A151201.000102-01691.sxm')
    inf = Infor(window)
    inf.initialize(data.c,data.param)
    print "hi"
    window.add(inf.table_info)
    window.show_all()
    window.present()
    main()
Esempio n. 5
0
class SPMBrowser():
    def __init__(self):
        # Definiton of the variables
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.path_selected = None
        self.navi = Navigator(self.window)
        self.info = Infor(self.window)
        self.oper = Operator(self.window)
        self.gwydata = GwyData()
        self.img_1 = Imager(self.window,400)
        self.img_2 = Imager(self.window,400)
        self.channel_img_1 = None
        self.channel_img_2 = None
        # Definition of the widget
        self.window.connect("destroy", lambda w: gtk.main_quit())
        self.window.set_title("SPMBrowser")
        # vbox_main
        self.vbox_main = gtk.VBox(False,0)
        # hbox_main
        self.hbox_main = gtk.HBox(False,0)
        self.vbox_2 = gtk.VBox(False,0)
        self.hbox_main.pack_start(self.img_1.vbox_main,1,1,0)
        self.hbox_main.pack_start(self.img_2.vbox_main,1,1,0)
        self.vbox_2.pack_start(self.info.table_info,0,1,0)
        self.vbox_2.pack_end(self.oper.vbox_main,0,1,0)
        self.hbox_main.pack_end(self.vbox_2,0,1,0)
        # pack
        self.vbox_main.pack_start(self.navi.vbox_main,0,1,0)
        self.vbox_main.pack_start(self.hbox_main,0,1,0)
        self.window.add(self.vbox_main)
        self.window.show_all()
        # Signal handling
        self.navi.combobox_files.connect('changed',self.update_all,None)
        self.img_1.combobox_channels.connect('changed',self.record_channels,None)
        self.img_2.combobox_channels.connect('changed',self.record_channels,None)
        #self.info.entry_ratio.connect('changed',self.update_info,None)
        self.window.connect('key_press_event',self._key_press_event)

    def update_all(self,widget,data):
        self.current_data = self.navi.get_full_path()
        if self.current_data:
            self.gwydata.load_data(self.current_data)
            self.info.initialize(widget,self.gwydata.param)
            #print self.gwydata.param['channels']
            self.img_1.initialize(self.gwydata,self.channel_img_1)
            self.img_2.initialize(self.gwydata,self.channel_img_2)
            self.oper.get_current_data(self.gwydata.get_container(),self.gwydata.get_param(),self.navi.get_path2save(),'Z')

    def record_channels(self,widget,data):
        self.gwydata.param['im_1_channel'] = self.img_1.channel_id
        self.gwydata.param['im_2_channel'] = self.img_2.channel_id
        self.channel_img_1 = self.img_1.get_active_channel()
        self.channel_img_2 = self.img_2.get_active_channel()
        self.oper.get_current_data(self.gwydata.get_container(),self.gwydata.get_param(),self.navi.path2save,'Z')
        #print self.navi.path2save

    def update_info(self,widget,data):
        self.info.update()

    def _key_press_event(self,widget,data):
        keyval = data.keyval
        #print keyval
        if keyval == 110:
            active = self.navi.combobox_files.get_active()
            if active >= 0:
                self.navi.go_forward(widget,data)
        if keyval == 98:
            active = self.navi.combobox_files.get_active()
            if active >= 0:
                self.navi.go_backward(widget,data)
    plt.text(5, w+int(round(w*0.03)),basename,fontsize=12)
    plt.text(5, w+int(round(w*0.06)),output_text,fontsize=12)
    if dest_dir:
        output_path = dest_dir
    else:
        output_path = os.path.join(dir_path,'temp')
    print 'convert to',output_path
    if not os.path.isdir(output_path):
        os.mkdir(output_path)
    count = 1
    if ch_out:
        output_name = basename[:-4] + '_'+ch_out+'_'+ str(count) + '.png'
    else:
        output_name = basename[:-4] + '_'+str(count) + '.png'
    #while os.path.exists(os.path.join(output_path,output_name)):
    #    count = count + 1
    #    output_name = basename + '_'+ch_out+'_'+ fb_ward+ '_' + str(count) + '.png'
    output = os.path.join(output_path,output_name)
    plt.axis('off')
    plt.xticks([])
    plt.yticks([])
    #plt.imsave(output,new,cmap=cm)
    plt.savefig(output,cmap=cm,bbox_inches='tight', pad_inches=0,dpi=300)
    plt.clf()

if __name__ == '__main__':
    gwydata = GwyData()
    gwydata.load_data('/home/jorghyq/Project/Gwyddion-Utils/test/A151117.155350-00742.sxm')
    save2png_text(gwydata)
    print gwydata.param['w_dim'],gwydata.param['h_dim']