def handler(self, name, data): if name == 'create_user': del data['name'] try: floorc = BASE_FLOORC + '\n'.join(['%s %s' % (k, v) for k, v in data.items()]) + '\n' with open(G.FLOORC_PATH, 'wb') as floorc_fd: floorc_fd.write(floorc.encode('utf-8')) utils.reload_settings() if False in [bool(x) for x in (G.USERNAME, G.API_KEY, G.SECRET)]: sublime.message_dialog('Something went wrong. You will need to sign up for an account to use Floobits.') api.send_error({'message': 'No username or secret'}) else: p = os.path.join(G.BASE_DIR, 'welcome.md') with open(p, 'wb') as fd: text = welcome_text % (G.USERNAME, self.host) fd.write(text.encode('utf-8')) d = utils.get_persistent_data() d['auto_generated_account'] = True utils.update_persistent_data(d) G.AUTO_GENERATED_ACCOUNT = True sublime.active_window().open_file(p) except Exception as e: msg.error(e) try: d = utils.get_persistent_data() d['disable_account_creation'] = True utils.update_persistent_data(d) finally: self.stop()
def handler(self, name, data): if name == "create_user": del data["name"] try: floorc = BASE_FLOORC + "\n".join(["%s %s" % (k, v) for k, v in data.items()]) + "\n" with open(G.FLOORC_PATH, "wb") as floorc_fd: floorc_fd.write(floorc.encode("utf-8")) utils.reload_settings() if False in [bool(x) for x in (G.USERNAME, G.API_KEY, G.SECRET)]: sublime.message_dialog( "Something went wrong. You will need to sign up for an account to use Floobits." ) api.send_error({"message": "No username or secret"}) else: p = os.path.join(G.BASE_DIR, "welcome.md") with open(p, "wb") as fd: text = welcome_text % (G.USERNAME, self.host) fd.write(text.encode("utf-8")) d = utils.get_persistent_data() d["auto_generated_account"] = True utils.update_persistent_data(d) G.AUTO_GENERATED_ACCOUNT = True sublime.active_window().open_file(p) except Exception as e: msg.error(e) try: d = utils.get_persistent_data() d["disable_account_creation"] = True utils.update_persistent_data(d) finally: self.stop()
def handler(self, name, data): if name == 'create_user': del data['name'] try: floorc = BASE_FLOORC + '\n'.join( ['%s %s' % (k, v) for k, v in data.items()]) + '\n' with open(G.FLOORC_PATH, 'wb') as floorc_fd: floorc_fd.write(floorc.encode('utf-8')) utils.reload_settings() if False in [ bool(x) for x in (G.USERNAME, G.API_KEY, G.SECRET) ]: sublime.message_dialog( 'Something went wrong. You will need to sign up for an account to use Floobits.' ) api.send_error({'message': 'No username or secret'}) else: p = os.path.join(G.BASE_DIR, 'welcome.md') with open(p, 'wb') as fd: text = welcome_text % (G.USERNAME, self.host) fd.write(text.encode('utf-8')) d = utils.get_persistent_data() d['auto_generated_account'] = True utils.update_persistent_data(d) G.AUTO_GENERATED_ACCOUNT = True sublime.active_window().open_file(p) except Exception as e: msg.error(e) try: d = utils.get_persistent_data() d['disable_account_creation'] = True utils.update_persistent_data(d) finally: self.stop()
def handler(self, name, data): if name == 'credentials': with open(G.FLOORC_PATH, 'wb') as floorc_fd: floorc = BASE_FLOORC + '\n'.join(['%s %s' % (k, v) for k, v in data['credentials'].items()]) + '\n' floorc_fd.write(floorc.encode('utf-8')) utils.reload_settings() # This only works because G.JOINED_WORKSPACE is False if not G.USERNAME or not G.SECRET: sublime.message_dialog('Something went wrong. See https://%s/help/floorc/ to complete the installation.' % self.host) api.send_error({'message': 'No username or secret'}) else: p = os.path.join(G.BASE_DIR, 'welcome.md') with open(p, 'wb') as fd: text = 'Welcome %s!\n\nYou\'re all set to collaborate. You may want to check out our docs at https://%s/help/plugins/#sublime-usage' % (G.USERNAME, self.host) fd.write(text.encode('utf-8')) sublime.active_window().open_file(p) self.stop()
def handler(self, name, data): if name == "credentials": with open(G.FLOORC_PATH, "wb") as floorc_fd: floorc = BASE_FLOORC + "\n".join(["%s %s" % (k, v) for k, v in data["credentials"].items()]) + "\n" floorc_fd.write(floorc.encode("utf-8")) utils.reload_settings() # This only works because G.JOINED_WORKSPACE is False if not G.USERNAME or not G.SECRET: sublime.message_dialog( "Something went wrong. See https://%s/help/floorc/ to complete the installation." % self.host ) api.send_error({"message": "No username or secret"}) else: p = os.path.join(G.BASE_DIR, "welcome.md") with open(p, "wb") as fd: text = ( "Welcome %s!\n\nYou're all set to collaborate. You may want to check out our docs at https://%s/help/plugins/#sublime-usage" % (G.USERNAME, self.host) ) fd.write(text.encode("utf-8")) sublime.active_window().open_file(p) self.stop()
def handler(self, name, data): if name == 'credentials': with open(G.FLOORC_PATH, 'wb') as floorc_fd: floorc = BASE_FLOORC + '\n'.join( ['%s %s' % (k, v) for k, v in data['credentials'].items()]) + '\n' floorc_fd.write(floorc.encode('utf-8')) utils.reload_settings( ) # This only works because G.JOINED_WORKSPACE is False if not G.USERNAME or not G.SECRET: sublime.message_dialog( 'Something went wrong. See https://%s/help/floorc/ to complete the installation.' % self.host) api.send_error({'message': 'No username or secret'}) else: p = os.path.join(G.BASE_DIR, 'welcome.md') with open(p, 'wb') as fd: text = 'Welcome %s!\n\nYou\'re all set to collaborate. You may want to check out our docs at https://%s/help/plugins/#sublime-usage' % ( G.USERNAME, self.host) fd.write(text.encode('utf-8')) sublime.active_window().open_file(p) self.stop()