Exemple #1
0
 def on_done(self, old, new):
     print 'on done'
     if s.get('close_affected_buffers_when_deleting_even_if_dirty', False):
         item = SideBarItem(new, os.path.isdir(new))
         item.close_associated_buffers()
     print 'closed associated buffers'
     self.remove(new)
     SideBarProject().refresh()
Exemple #2
0
	def on_done(self, old, new):
		print 'on done'
		if s.get('close_affected_buffers_when_deleting_even_if_dirty', False):
			item = SideBarItem(new, os.path.isdir(new))
			item.close_associated_buffers()
		print 'closed associated buffers'
		self.remove(new)
		SideBarProject().refresh();
Exemple #3
0
	def on_done(self, old, new):
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.move(new):
				sublime.error_message("Unable to move, destination exists.")
				self.run([old], new)
				return
		except:
			sublime.error_message("Unable to move:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], new)
			return
		SideBarProject().refresh();
Exemple #4
0
	def on_done(self, old, new):
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.move(new):
				sublime.error_message("Unable to move, destination exists.")
				self.run([old], new)
				return
		except:
			sublime.error_message("Unable to move:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], new)
			return
		SideBarProject().refresh();
Exemple #5
0
    def run(self, paths=[]):
        item = SideBarItem(
            os.path.join(sublime.packages_path(), 'User',
                         'SideBarEnhancements', 'Open With',
                         'Side Bar.sublime-menu'), False)
        if not item.exists():
            item.create()
            item.write("""[
	{"id": "side-bar-files-open-with",
		"children":
		[

			//application 1
			{
				"caption": "Photoshop",
				"id": "side-bar-files-open-with-photoshop",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "Adobe Photoshop CS5.app", // OSX
									"extensions":"psd|png|jpg|jpeg"  //any file with these extensions
								}
			},

			//separator
			{"caption":"-"},

			//application 2
			{
				"caption": "SeaMonkey",
				"id": "side-bar-files-open-with-seamonkey",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "C:\\\\Archivos de programa\\\\SeaMonkey\\\\seamonkey.exe", // WINNT
									"extensions":"" //open all even folders
								}
			},
			//application n
			{
				"caption": "Chrome",
				"id": "side-bar-files-open-with-chrome",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "C:\\\\Documents and Settings\\\\tito\\\\Configuración local\\\\Datos de programa\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe",
									"extensions":".*" //any file with extension
								}
			},

			{"caption":"-"}
		]
	}
]""")
        item.edit()
Exemple #6
0
	def run(self, paths = []):
		item = SideBarItem(os.path.join(sublime.packages_path(), 'User', 'SideBarEnhancements', 'Open With', 'Side Bar.sublime-menu'), False)
		if not item.exists():
			item.create()
			item.write("""[
	{"id": "side-bar-files-open-with",
		"children":
		[

			//application 1
			{
				"caption": "Photoshop",
				"id": "side-bar-files-open-with-photoshop",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "Adobe Photoshop CS5.app", // OSX
									"extensions":"psd|png|jpg|jpeg"  //any file with these extensions
								}
			},

			{"caption":"-"}
		]
	}
]""");
		item.edit()
Exemple #7
0
	def on_done(self, old, branch, leaf):
		self.window.run_command('hide_panel');
		leaf = leaf.strip();
		new = os.path.join(branch, leaf)
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.move(new):
				sublime.error_message("Unable to rename, destination exists.")
				self.run([old], leaf)
				return
		except:
			sublime.error_message("Unable to rename:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], leaf)
			raise
			return
		SideBarProject().refresh();
Exemple #8
0
	def on_done(self, old, branch, leaf):
		self.window.run_command('hide_panel');
		leaf = leaf.strip();
		new = os.path.join(branch, leaf)
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.move(new):
				sublime.error_message("Unable to rename, destination exists.")
				self.run([old], leaf)
				return
		except:
			sublime.error_message("Unable to rename:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], leaf)
			raise
			return
		SideBarProject().refresh();
Exemple #9
0
	def run(self, paths = []):
		item = SideBarItem(os.path.join(sublime.packages_path(), 'User', 'SideBarEnhancements', 'Open With', 'Side Bar.sublime-menu'), False)
		if not item.exists():
			item.create()
			item.write("""[
	{"id": "side-bar-files-open-with",
		"children":
		[

			//application 1
			{
				"caption": "Photoshop",
				"id": "side-bar-files-open-with-photoshop",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "Adobe Photoshop CS5.app", // OSX
									"extensions":"psd|png|jpg|jpeg"  //any file with these extensions
								}
			},

			//separator
			{"caption":"-"},

			//application 2
			{
				"caption": "SeaMonkey",
				"id": "side-bar-files-open-with-seamonkey",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "C:\\\\Archivos de programa\\\\SeaMonkey\\\\seamonkey.exe", // WINNT
									"extensions":"" //open all even folders
								}
			},
			//application n
			{
				"caption": "Chrome",
				"id": "side-bar-files-open-with-chrome",

				"command": "side_bar_files_open_with",
				"args": {
									"paths": [],
									"application": "C:\\\\Documents and Settings\\\\tito\\\\Configuración local\\\\Datos de programa\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe",
									"extensions":".*" //any file with extension
								}
			},

			{"caption":"-"}
		]
	}
]""");
		item.edit()
Exemple #10
0
	def on_done(self, paths, name):
		for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
			item = SideBarItem(item.join(name), True)
			if item.exists():
				sublime.error_message("Unable to create folder, folder or file exists.")
				self.run(paths, name)
				return
			else:
				item.create()
				if not item.exists():
					sublime.error_message("Unable to create folder:\n\n"+item.path())
					self.run(paths, name)
					return
		SideBarProject().refresh();
Exemple #11
0
 def on_done(self, paths, name):
     for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
         item = SideBarItem(item.join(name), False)
         if item.exists():
             sublime.error_message(
                 "Unable to create file, file or folder exists.")
             self.run(paths, name)
             return
         else:
             try:
                 item.create()
                 item.edit()
             except:
                 sublime.error_message("Unable to create file:\n\n" +
                                       item.path())
                 self.run(paths, name)
                 return
     SideBarProject().refresh()
Exemple #12
0
	def on_done(self, old, new):
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.copy(new):
				sublime.error_message("Unable to duplicate, destination exists.")
				self.run([old], new)
				return
		except:
			sublime.error_message("Unable to copy:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], new)
			return
		item = SideBarItem(new, os.path.isdir(new))
		if item.isFile():
			item.edit();
		SideBarProject().refresh();
Exemple #13
0
	def on_done(self, paths, name):
		for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
			item = SideBarItem(item.join(name), False)
			if item.exists():
				sublime.error_message("Unable to create file, file or folder exists.")
				self.run(paths, name)
				return
			else:
				try:
					item.create()
					item.edit()
				except:
					sublime.error_message("Unable to create file:\n\n"+item.path())
					self.run(paths, name)
					return
		SideBarProject().refresh();
Exemple #14
0
	def confirm(self, paths, in_parent, data):
		import functools
		window = sublime.active_window()
		# window.show_input_panel("BUG!", '', '', None, None)
		# window.run_command('hide_panel');

		yes = []
		yes.append('Yes, Replace the following items:');
		for item in data:
			yes.append(SideBarItem(item, os.path.isdir(item)).pathWithoutProject())

		no = []
		no.append('No');
		no.append('Continue without replacing');

		window.show_quick_panel([yes, no], functools.partial(self.on_done, paths, in_parent))
Exemple #15
0
	def on_done(self, paths, name):
		for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
			item = SideBarItem(item.join(name), True)
			if item.exists():
				sublime.error_message("Unable to create folder, folder or file exists.")
				self.run(paths, name)
				return
			else:
				item.create()
				if not item.exists():
					sublime.error_message("Unable to create folder:\n\n"+item.path())
					self.run(paths, name)
					return
		SideBarProject().refresh();
Exemple #16
0
	def on_done(self, old, new):
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.copy(new):
				sublime.error_message("Unable to duplicate, destination exists.")
				self.run([old], new)
				return
		except:
			sublime.error_message("Unable to copy:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], new)
			return
		item = SideBarItem(new, os.path.isdir(new))
		if item.isFile():
			item.edit();
		SideBarProject().refresh();
 def on_done(self, paths, name):
     for folder_item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
         folder_item = SideBarItem(folder_item.join(name), True)
         if folder_item.exists():
             sublime.error_message("Unable to create folder, folder or file exists.")
             self.run(paths, name)
             return
         else:
             try:
                 folder_item.create()
                 init_item = SideBarItem(folder_item.join('__init__.py'), False)
                 init_item.create()
             except:
                 sublime.error_message("Unable to create file:\n\n" + init_item.path())
                 self.run(paths, name)
                 return
             if not folder_item.exists():
                 sublime.error_message("Unable to create folder:\n\n" + folder_item.path())
                 self.run(paths, name)
                 return
     SideBarProject().refresh()
Exemple #18
0
	def run(self, paths = [], in_parent = 'False', test = 'True', replace = 'False'):
		s = sublime.load_settings("SideBarEnhancements/Clipboard.sublime-settings")

		cut = s.get('cut', '')
		copy = s.get('copy', '')

		already_exists_paths = []

		if SideBarSelection(paths).len() > 0:
			if in_parent == 'False':
				location = SideBarSelection(paths).getSelectedItems()[0].path()
			else:
				location = SideBarSelection(paths).getSelectedDirectoriesOrDirnames()[0].dirname()

			if os.path.isdir(location) == False:
				location = SideBarItem(os.path.dirname(location), True)
			else:
				location = SideBarItem(location, True)

			if cut != '':
				cut = cut.split("\n")
				for path in cut:
					path = SideBarItem(path, os.path.isdir(path))
					new  = os.path.join(location.path(), path.name())
					if test == 'True' and os.path.exists(new):
						already_exists_paths.append(new)
					elif test == 'False':
						if os.path.exists(new) and replace == 'False':
							pass
						else:
							try:
								if not path.move(new, replace == 'True'):
									sublime.error_message("Unable to cut and paste, destination exists.")
									return
							except:
								sublime.error_message("Unable to move:\n\n"+path.path()+"\n\nto\n\n"+new)
								return

			if copy != '':
				copy = copy.split("\n")
				for path in copy:
					path = SideBarItem(path, os.path.isdir(path))
					new  = os.path.join(location.path(), path.name())
					if test == 'True' and os.path.exists(new):
						already_exists_paths.append(new)
					elif test == 'False':
						if os.path.exists(new) and replace == 'False':
							pass
						else:
							try:
								if not path.copy(new, replace == 'True'):
									sublime.error_message("Unable to copy and paste, destination exists.")
									return
							except:
								sublime.error_message("Unable to copy:\n\n"+path.path()+"\n\nto\n\n"+new)
								return

			if test == 'True' and len(already_exists_paths):
				self.confirm(paths, in_parent, already_exists_paths)
			elif test == 'True' and not len(already_exists_paths):
				self.run(paths, in_parent, 'False', 'False')
			elif test == 'False':
				cut = s.set('cut', '')
				SideBarProject().refresh();
Exemple #19
0
    def run(self, paths=[], in_parent='False', test='True', replace='False'):
        s = sublime.load_settings(
            "SideBarEnhancements/Clipboard.sublime-settings")

        cut = s.get('cut', '')
        copy = s.get('copy', '')

        already_exists_paths = []

        if SideBarSelection(paths).len() > 0:
            if in_parent == 'False':
                location = SideBarSelection(paths).getSelectedItems()[0].path()
            else:
                location = SideBarSelection(
                    paths).getSelectedDirectoriesOrDirnames()[0].dirname()

            if os.path.isdir(location) == False:
                location = SideBarItem(os.path.dirname(location), True)
            else:
                location = SideBarItem(location, True)

            if cut != '':
                cut = cut.split("\n")
                for path in cut:
                    path = SideBarItem(path, os.path.isdir(path))
                    new = os.path.join(location.path(), path.name())
                    if test == 'True' and os.path.exists(new):
                        already_exists_paths.append(new)
                    elif test == 'False':
                        if os.path.exists(new) and replace == 'False':
                            pass
                        else:
                            try:
                                if not path.move(new, replace == 'True'):
                                    sublime.error_message(
                                        "Unable to cut and paste, destination exists."
                                    )
                                    return
                            except:
                                sublime.error_message("Unable to move:\n\n" +
                                                      path.path() +
                                                      "\n\nto\n\n" + new)
                                return

            if copy != '':
                copy = copy.split("\n")
                for path in copy:
                    path = SideBarItem(path, os.path.isdir(path))
                    new = os.path.join(location.path(), path.name())
                    if test == 'True' and os.path.exists(new):
                        already_exists_paths.append(new)
                    elif test == 'False':
                        if os.path.exists(new) and replace == 'False':
                            pass
                        else:
                            try:
                                if not path.copy(new, replace == 'True'):
                                    sublime.error_message(
                                        "Unable to copy and paste, destination exists."
                                    )
                                    return
                            except:
                                sublime.error_message("Unable to copy:\n\n" +
                                                      path.path() +
                                                      "\n\nto\n\n" + new)
                                return

            if test == 'True' and len(already_exists_paths):
                self.confirm(paths, in_parent, already_exists_paths)
            elif test == 'True' and not len(already_exists_paths):
                self.run(paths, in_parent, 'False', 'False')
            elif test == 'False':
                cut = s.set('cut', '')
                SideBarProject().refresh()
Exemple #20
0
	def on_done(self, paths, relative_to_project, name):
		if relative_to_project and s.get('new_files_relative_to_project_root'):
			paths = SideBarProject().getDirectories()
			if paths:
				paths = [SideBarItem(paths[0], False)]
			if not paths:
				paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames()
		else:
			paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames()
		if not paths:
			paths = SideBarProject().getDirectories()
			if paths:
				paths = [SideBarItem(paths[0], False)]
		if not paths:
			sublime.active_window().new_file()
		else:
			for item in paths:
				item = SideBarItem(item.join(name), False)
				if item.exists():
					sublime.error_message("Unable to create file, file or folder exists.")
					self.run(paths, name)
					return
				else:
					try:
						item.create()
						item.edit()
					except:
						sublime.error_message("Unable to create file:\n\n"+item.path())
						self.run(paths, name)
						return
			SideBarProject().refresh();
Exemple #21
0
 def run(self, paths=[]):
     project = SideBarProject()
     if project.hasOpenedProject():
         SideBarItem(project.getProjectFile(), False).edit()
Exemple #22
0
	def run(self, paths = []):
		SideBarItem(sublime.packages_path()+'/../Settings/SideBarEnhancements.json', False).edit();
Exemple #23
0
def check_version():
	version = '11.13.2012.1305.0';
	if s.get('version') != version:
		SideBarItem(sublime.packages_path()+'/SideBarEnhancements/messages/'+version+'.txt', False).edit();
		s.set('version', version);
		sublime.save_settings('Side Bar.sublime-settings')