Exemplo n.º 1
0
    def do_paste_as(self, path):

        # Save source name
        source_name = self.item_buffer[0]["file_name"]

        def on_done(target_name):
            self.item_buffer[0]["file_name"] = target_name
            self.do_paste(path)

        show_input_panel(self.window, "Paste As:", source_name, on_done)
	def do_paste_as(self, path):

		# Save source name
		source_name = self.item_buffer[0]["file_name"]

		def on_done(target_name):
			self.item_buffer[0]["file_name"] = target_name
			self.do_paste(path)

		show_input_panel(self.window, "Paste As:", source_name, on_done)
	def do_rename(self, path):

		# Reset FileNavigatorCommand
		self.cls.reset()

		# Save source name
		source_name = os.path.basename(path)

		def on_done(target_name):
			target_path = path[:-len(source_name)] + target_name
			shutil.move(path, target_path)
			sublime.status_message("%s renamed to %s" % (source_name, target_name))

		show_input_panel(self.window, "Rename:", source_name, on_done)
Exemplo n.º 4
0
    def do_rename(self, path):

        # Reset FileNavigatorCommand
        self.cls.reset()

        # Save source name
        source_name = os.path.basename(path)

        def on_done(target_name):
            target_path = path[:-len(source_name)] + target_name
            shutil.move(path, target_path)
            sublime.status_message("%s renamed to %s" %
                                   (source_name, target_name))

        show_input_panel(self.window, "Rename:", source_name, on_done)
Exemplo n.º 5
0
    def do_new_file(self, path):

        # Reset FileNavigatorCommand
        self.cls.reset()

        def on_done(file_name):
            file_path = os.path.join(path, file_name)
            if os.path.exists(file_path):
                sublime.error_message('File already exists:\n%s' % file_path)
            else:
                with open(file_path, 'w') as f:
                    pass
                self.window.open_file(file_path)

        show_input_panel(self.window, "New file name:", '', on_done)
	def do_new_file(self, path):

		# Reset FileNavigatorCommand
		self.cls.reset()

		def on_done(file_name):
			file_path = os.path.join(path, file_name)
			if os.path.exists(file_path):
					sublime.error_message('File already exists:\n%s' % file_path)
			else:
				with open(file_path, 'w') as f:
					pass
				self.window.open_file(file_path)

		show_input_panel(self.window, "New file name:", '', on_done)
	def do_new_directory(self, path):

		# Reset FileNavigatorCommand
		self.cls.reset()

		def on_done(dir_name):
			# Reset FileNavigatorCommand
			FileNavigatorCommand.reset()
			
			dir_path = os.path.join(path, dir_name)
			if os.path.exists(dir_path):
					sublime.error_message('Directory already exists:\n%s' % dir_path)
			else:
				os.mkdir(dir_path)

		show_input_panel(self.window, "New directory name:", '', on_done)
Exemplo n.º 8
0
    def do_new_directory(self, path):

        # Reset FileNavigatorCommand
        self.cls.reset()

        def on_done(dir_name):
            # Reset FileNavigatorCommand
            FileNavigatorCommand.reset()

            dir_path = os.path.join(path, dir_name)
            if os.path.exists(dir_path):
                sublime.error_message('Directory already exists:\n%s' %
                                      dir_path)
            else:
                os.mkdir(dir_path)

        show_input_panel(self.window, "New directory name:", '', on_done)