def find_project_root(self, path):
        f = File(path)
        project_files = (".git", ".ropeproject", ".bzr", ".hg", ".scribes_project")
        while True:
            if any(f.get_child(r).query_exists() for r in project_files):
                return f.get_uri()

            p = f.get_parent()
            if p:
                f = p
            else:
                return path
    def find_project_root(self, path):
        f = File(path)
        project_files = ('.git', '.ropeproject', '.bzr', '.hg',
                         '.scribes_project')
        while True:
            if any(f.get_child(r).query_exists() for r in project_files):
                return f.get_uri()

            p = f.get_parent()
            if p:
                f = p
            else:
                return path
Exemplo n.º 3
0
def find_project_root(uri):
    f = File(uri)
    special_names = ('.ropeproject', '.git', '.hg', '.bzr', '.scribes_project')
    while True:
        for name in special_names:
            if f.get_child(name).query_exists():
                return f.get_path()

        p = f.get_parent()
        if p:
            f = p
        else:
            return None
Exemplo n.º 4
0
def find_project_root(uri):
    f = File(uri)
    special_names = ('.ropeproject', '.git', '.hg', '.bzr', '.scribes_project')
    while True:
        for name in special_names:
            if f.get_child(name).query_exists():
                return f.get_path()

        p = f.get_parent()
        if p:
            f = p
        else:
            return None
Exemplo n.º 5
0
	def __select(self):
		try:
			if not self.__editor.uri: raise ValueError
			from gio import File 
			gfile = File(self.__editor.uri)
			folder_uri = gfile.get_parent().get_uri()
			if folder_uri != self.__chooser.get_current_folder_uri():
				self.__chooser.set_current_folder_uri(folder_uri)
			fileinfo = gfile.query_info("standard::display-name")
			self.__chooser.set_current_name(fileinfo.get_display_name())
		except ValueError:
			self.__chooser.set_current_name(_("Unsaved Document"))
			self.__chooser.set_current_folder(self.__editor.desktop_folder)
		return False
def get_python_title(uri):
    f = File(uri)
    title = f.get_basename()
    packages = []
    while True:
        f = f.get_parent()
        if not f: break
        
        if f.get_child('__init__.py').query_exists():
            packages.append(f.get_basename())
        else:
            break
            
    if packages:
        if title != '__init__.py':
            packages.insert(0, title.partition('.py')[0])
            
        return '.'.join(reversed(packages))
    else:
        return title