def configure(self, window): tree = Utils.dataprovider_glade_get_widget( __file__, "config.glade", "OpenERPConfiguration") #get a whole bunch of widgets servername = tree.get_widget("servername") port = tree.get_widget("port") loadbtn=tree.get_widget("loaddb") username = tree.get_widget("username") password = tree.get_widget("password") sourceComboBox = tree.get_widget("combobox") #preload the widgets servername.set_text("http://localhost") port.set_text("8069") username.set_text(self.username) password.set_text(self.password) store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) sourceComboBox.set_model(store) cell = gtk.CellRendererText() sourceComboBox.pack_start(cell, True) sourceComboBox.add_attribute(cell, 'text', 0) sourceComboBox.set_active(0) dlg = tree.get_widget("OpenERPConfiguration") dlg.set_transient_for(window) signalConnections = { "on_load_database_clicked" : (self._loadDatabase, tree) } tree.signal_autoconnect( signalConnections ) response = Utils.run_dialog (dlg, window) if response: sock1 = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common') user_id = sock1.login('conduit',username.get_text(),password.get_text()) self.selected = store.get_value(sourceComboBox.get_active_iter(), 1) if user_id: log.warn("login successfully %s",user_id) """sock_obj = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object') res = sock_obj.execute('conduit',user_id,'a','res.partner','search',[]) self.res_address = sock_obj.execute('conduit',user_id,'a','res.partner.address','name_get',res) log.warn("object fetched successfully %s",self.res_address)""" Msg="Login Successfully" msgDlg=gtk.MessageDialog(type=gtk.MESSAGE_INFO,message_format=Msg,buttons=gtk.BUTTONS_OK) msgDlg.run() msgDlg.destroy() else: errorMsg="Please Enter Valid Username & password" errorDlg=gtk.MessageDialog(type=gtk.MESSAGE_ERROR,message_format=errorMsg,buttons=gtk.BUTTONS_OK) errorDlg.run() errorDlg.destroy() log.warn("Please try again %s",user_id) self.set_configured(True) dlg.destroy()
def exampledata_to_file(self, data, **kwargs): """ Converts exampledata to a file containing the text """ f = Utils.new_tempfile( contents=data.get_string() ) return f