def highlight_conflict_group(view, group): scope = group + '_gutter' if settings.get(scope): conflict_regions = view.find_all(conflict_re.CONFLICT_GROUP_REGEX[group]) if not conflict_regions: return # Remove the first and last line since they just contain the separators highlight_regions = [] for region in conflict_regions: region = view.split_by_newlines(region)[1:-1] # Ignore empty subregions if not region: continue for subregion in region: highlight_regions.append(subregion) view.erase_regions("GitConflictRegion_" + group) view.add_regions( "GitConflictRegions_" + group, highlight_regions, "warning", icons.get(group), draw.hidden() )
def __init__(self): """ Initialize the object """ self.manga_path = Manga.directory self.location = 'Web' self.main_menu = os.path.join(self.location, 'index.html') self.chapter_seperation = settings.get().image_separation
def highlight_conflicts(view): conflict_regions = view.find_all(conflict_re.NO_NAMING_GROUPS_PATTERN) view.erase_regions("GitConflictRegions") view.add_regions("GitConflictRegions", conflict_regions, settings.get('matching_scope'), "", draw.visible()) highlight_conflict_group(view, 'head') highlight_conflict_group(view, 'ancestor') highlight_conflict_group(view, 'current')
def highlight_conflicts(view): conflict_regions = view.find_all(conflict_re.NO_NAMING_GROUPS_PATTERN) view.erase_regions("GitConflictRegions") view.add_regions( "GitConflictRegions", conflict_regions, settings.get('matching_scope'), "", draw.visible() ) highlight_conflict_group(view, 'ours') highlight_conflict_group(view, 'ancestor') highlight_conflict_group(view, 'theirs')
def get_representation_list(self, conflict_files): """Returns a list with only filenames if the 'show_only_filenames' option is set, otherwise it returns just a clone of the given list""" result = None if settings.get('show_only_filenames'): result = [] for string in conflict_files: result.append(string.rpartition('/')[2]) else: result = list(conflict_files) # Add an "Open all ..." option result.insert(0, msgs.get('open_all')) return result
def download_link(manga: models.Manga, chapters=None): if not chapters: manga, chapters = manga.parse() exists = manga.title in database.manga.databases.keys() if exists: with Loader("Update database"): # check database and update chapters database.manga.databases[manga.title].update_chapter_list(chapters) # get new chapters from updated database chapters = database.manga.databases[manga.title].get_chapter_list() # get settings s = settings.get() question = { 'type': 'checkbox', 'name': 'chapter', 'message': 'Select chapters to download', 'choices': [ dict(name=chapter.title, disabled='Downloaded' if s.disable_downloaded and chapter.downloaded else False) for chapter in chapters ], } answers = prompt(question) if not answers['chapters']: return selected = [] for chapter in chapters: if chapter.title in answers['chapters']: selected.append(chapter) selective_download(manga, chapters, selected, update=not exists)
def on_pre_save(self, view): if settings.get('live_matching'): highlight_conflicts(view)
def on_activated(self, view): if settings.get('live_matching'): highlight_conflicts(view)