def add_clearance_graph(self):
     print("-----------------------------------------")
     horizontal_clearance = self.clearance_analysis.horizontal_clearance
     x_init = self.graph_zero[0] + self.line_extend
     y_init = self.graph_zero[1]
     for i in range(len(horizontal_clearance)):
         clearance_points = horizontal_clearance[i]
         x = x_init + i * self.dimension_analysis.section_distance * self.length_multiplier
         left = -self.dimension_analysis.domain_length
         right = self.dimension_analysis.domain_length
         if clearance_points[0]:
             left = clearance_points[0]
         if clearance_points[1]:
             right = clearance_points[1]
         clearance = right - left
         y_top = y_init + left * self.height_multiplier
         y_bottom = y_init + right * self.height_multiplier
         pen_red = QPen()
         red = Color.create_qcolor_from_rgb_tuple(Color.red)
         pen_red.setColor(red)
         pen_green = QPen()
         green = Color.create_qcolor_from_rgb_tuple(Color.green)
         pen_green.setColor(green)
         line = QGraphicsLineItem(x, y_top, x, y_bottom)
         if clearance < self.min_horizontal_clearance:
             line.setPen(pen_red)
         else:
             line.setPen(pen_green)
         self.addToGroup(line)
     pass
Пример #2
0
    def __init__(self,
                 url,
                 start_episode,
                 end_episode,
                 session,
                 gui=None,
                 token=None):
        super().__init__(url, start_episode, end_episode, session, gui)
        self.token = token
        self.api_key = None
        self.ts_no = None
        self.server_id = None
        self.site_key = "6LfEtpwUAAAAABoJ_595sf-Hh0psstoatwZpLex1"
        self.server_name = "Mp4upload"
        self.nine_anime_url = "https://9anime.to"

        self.episodes_url = "https://9anime.to/ajax/film/servers/" + url.split(
            ".")[2].split("/")[0]

        if not token:
            try:
                with open("settings.json") as (json_file):
                    data = json.load(json_file)
                    self.api_key = data["api_key"]
            except:
                Color.printer(
                    "ERROR",
                    "Reading settings file failed! Continue without API key...",
                    self.gui)
                self.api_key = ""
Пример #3
0
    def __init__(self,
                 window: Window,
                 text: str,
                 pos: Vector,
                 size: Vector = Vector(150, 50),
                 bg: Color = Color(200, 200, 200),
                 fg: Color = Color(20, 20, 20),
                 bg_over: Color = Color(220, 220, 220),
                 fg_over: Color = Color(20, 20, 20),
                 border_size: int = 0,
                 font: Font = Font('sans-serif', 15, HIDPI_FACTOR)):
        super().__init__(window)
        self._click_handler = None

        self.text = text
        self.pos = pos
        self.size = size

        # Initial colours
        self.bg = bg
        self.fg = fg
        self.bg_over = bg_over
        self.fg_over = fg_over

        # Extra
        self.font = font
        self.border_size = border_size

        # Center
        self.center = (self.pos[0] + self.size[0] / 2,
                       self.pos[1] + self.size[1] / 2)

        # Get corners
        self.bounds = BoundingBox(pos, pos + size)
Пример #4
0
def extract_download_urls():
    global session, gui
    down_base = "https://9anime.to/ajax/episode/info?"

    Color.printer("INFO", "Extracting download URLs...", gui)
    for episode in episodes:
        if (episode.id is None):
            episode.download_url = None
            continue

        url = down_base + "ts=" + ts_no + "&id=" + episode.id + "&server=" + server_id
        target = session.get(url).json()["target"]

        episode.page_url = target

        download_url = Mp4UploadExtractor(target, session).extract_direct_url()

        # video_page = session.get(target).content
        #
        # string = video_page.decode("utf-8")
        #
        # www_base = re.search("false\|(.*)\|devicePixelRatio",string).group(1)
        # url_id = re.search("video\|(.*)\|282", string).group(1)
        #
        # download_url = "https://"+www_base+".mp4upload.com:282/d/"+url_id+"/video.mp4"

        episode.download_url = download_url
Пример #5
0
def get_token(url):
    global session, site_key, api_key, gui

    try:
        captcha_id = \
        session.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}&invisible=1"
                     .format(api_key, site_key, url)).text.split('|')[1]

        recaptcha_answer = session.get(
            "http://2captcha.com/res.php?key={}&action=get&id={}".format(
                api_key, captcha_id)).text

        while 'CAPCHA_NOT_READY' in recaptcha_answer:
            sleep(5)
            recaptcha_answer = session.get(
                "http://2captcha.com/res.php?key={}&action=get&id={}".format(
                    api_key, captcha_id)).text

        recaptcha_answer = recaptcha_answer.split('|')[1]

        # print("[Recaptcha answer] : {",recaptcha_answer,"}")
        return recaptcha_answer

    except Exception:
        Color.printer("ERROR", 'Failed to solve ReCaptcha!', gui)
        return None
Пример #6
0
    def __init__(self, window: Window):
        super().__init__(window)

        from constants import BUTTON_SIZE

        window_size = window.get_size()
        window_center = (window_size[0] / 2, window_size[1] / 2)

        dpi_factor = window.hidpi_factor

        button_size = (BUTTON_SIZE[0] * dpi_factor,
                       BUTTON_SIZE[1] * dpi_factor)
        button_font = Font('sans-serif', 16, dpi_factor)

        self.bg_image = util.load_image('assets/background.png')

        back_btn = Button(window,
                          '[ Back ]',
                          Vector(window_center[0] - button_size[0] / 2,
                                 window_size[1] * 2 / 3),
                          Vector(*button_size),
                          Color(0, 102, 255),
                          Color(255, 255, 255),
                          Color(0, 80, 230),
                          Color(255, 255, 255),
                          font=button_font)
        back_btn.set_click_handler(self.back)
        self.children.append(back_btn)
Пример #7
0
    def __extract_page_urls(self):
        Color.printer("INFO", "Extracting page URLs...", self.gui)

        page = self.session.get(self.url).content

        soup_html = BeautifulSoup(page, "html.parser")

        try:
            server = soup_html.findAll("div", attrs={"class": "server"})[0]
            epi_ranges = server.findAll("ul", attrs={"class": "episodes"})

            for epi_range in epi_ranges:
                epi_tags = epi_range.findAll("a", href=True)

                for epi_tag in epi_tags:
                    epi_number = int(epi_tag.text)

                    if epi_number < self.start_episode or epi_number > self.end_episode:
                        continue

                    episode = Episode(str(epi_number),
                                      "Episode - " + str(epi_number))
                    episode.page_url = epi_tag["href"]

                    self.episodes.append(episode)

        except Exception as ex:
            print(ex)
            return None

        return self.episodes
def analysis(img, target_color = (255, 255, 255)):
    """
    Esse metodo verifica cada pixel da imagem em busca dos pixel
    da cor procurada. Toda vez que for encontrado um pixel da cor procurada
    se aplica o floodFill para se marca o caminho
    """
    from random import randint
    #path_number = -1
    path_number = 0
    #color = 10
    color = Color()
    path_list = []
    for i in range(img.size[0]):
        for j in range(img.size[1]):
            if img.getpixel((i,j)) == target_color:
                path_number = path_number + 1
                if (path_number / 2) == 0:
                    a = color.corHSVAliatoria(randint(50,200))
                else:
                    a = color.corRGBAliatoria(randint(50,200))
                #result = floodFill(img, (i,j), target_color, color)
                result = floodFill(img, (i,j), target_color, a)
                path_list.append(result)
                #color=color+5
    #img.save()
    return (path_list,img)
 def set_color_picker_value(self):
     color = self.color_temp
     r, g, b = Color.from_factor_to_rgb(color[0], color[1], color[2])
     q_color = QColor(r, g, b)
     new_color = QColorDialog.getColor(q_color)
     button = self.ui.pushButton_colorPicker
     self.color_temp = Color.from_rgb_to_factor(new_color.red(), new_color.green(), new_color.blue())
     button.setStyleSheet("background-color: rgb({},{},{})".format(new_color.red(), new_color.green(), new_color.blue()))
Пример #10
0
    def _process_args(self):
        if self.args.no_color == True:
            Color.disable()

        if self.args.command == "lvm":
            self.__lvm()
        elif self.args.command == "backup":
            self.__backup()
Пример #11
0
 def draw(self, windows):  # pragma: no cover
     body = windows['body']
     body.clear()
     line = 10
     body.addstr(line - 2, 20, 'SPACE JAIL', Color.use('red'))
     body.addstr(line + self.current_option, 20, '#', Color.use('blue'))
     for option in self.options:
         body.addstr(line, 22, option.capitalize(), Color.use('white'))
         line += 1
Пример #12
0
 def run(self):
     while True:
         func, arg, kargs = self.tasks.get()
         try:
             func(*arg, **kargs)
         except Exception as ex:
             Color.printer("ERROR", ex, self.gui)
         finally:
             self.tasks.task_done()
Пример #13
0
 def print_inventory(self, window, inv):  #pragma: no cover
     for i in range(0, len(inv)):
         name_x = 1 if i % 2 is 0 else 40
         name_y = (i / 2) + 1
         q_x = 20 if name_x is 1 else 61
         q_y = name_y
         window.addstr(name_y, name_x, inv[i]['name'], Color.use('white'))
         window.addstr(q_y, q_x, str(inv[i]['quantity']),
                       Color.use('white'))
Пример #14
0
def write_data():
    global episodes, gui

    Color.printer("INFO", "Writing results to results.csv file...", gui)
    data_file = open("results.csv", "w")
    for episode in episodes:
        data_file.write(episode.episode + "," + episode.download_url + "\n")

    data_file.close()
Пример #15
0
    def __download_episode(self, episode):
        if system() == "Windows":
            episode.title = self.__clean_file_name(episode.title)

        if episode.is_direct:
            if episode.download_url is None:
                Color.printer(
                    "ERROR", "Download URL is not set for " + episode.episode +
                    ", skipping...", self.gui)
                return

            Color.printer("INFO", "Downloading " + episode.episode + "...",
                          self.gui)

            # print(self.is_titles)
            # print(episode.title)

            if self.is_titles:
                # print("with title")
                file_name = self.directory + episode.episode + " - " + episode.title + ".mp4"
            else:
                # print("without title")
                file_name = self.directory + episode.episode + ".mp4"

            with requests.get(episode.download_url,
                              headers=episode.request_headers,
                              stream=True,
                              verify=False) as r:
                with open(file_name, 'wb') as f:
                    shutil.copyfileobj(r.raw, f, length=16 * 1024 * 1024)

            Color.printer("INFO", episode.episode + " finished downloading...",
                          self.gui)

        else:
            Color.printer(
                "INFO",
                "HLS link found. Using custom HLSDownloader to download...",
                self.gui)
            try:
                HLSDownloader(episode, self.directory, requests.session(),
                              self.gui).download()
            except Exception as ex:
                trace = traceback.format_exc()
                print(trace)
                Color.printer(
                    "ERROR",
                    "Custom HLS Downloader failed! Using FFMPEG to download...",
                    self.gui)
                FFMPEGDownloader(episode, self.directory, self.gui).download()
Пример #16
0
    def __init__(self, window: Window):
        super().__init__(window)

        from constants import BUTTON_SIZE

        self.window_size = window.get_size()
        self.window_center = (self.window_size[0] / 2, self.window_size[1] / 2)

        dpi_factor = window.hidpi_factor

        button_size = (BUTTON_SIZE[0] * dpi_factor,
                       BUTTON_SIZE[1] * dpi_factor)
        button_font = Font('sans-serif', 16, dpi_factor)

        self.bg_image = util.load_image('assets/background.png')
        self.bg_size = (self.bg_image.get_width(), self.bg_image.get_height())
        self.bg_center = (self.bg_size[0] / 2, self.bg_size[1] / 2)

        self.logo = util.load_image('assets/logo.png')
        self.logo_size = (self.logo.get_width(), self.logo.get_height())
        self.logo_center = (self.logo_size[0] / 2, self.logo_size[1] / 2)

        self.max_score = 0
        self.last_active_level = None

        self.text_font = Font('monospace', 20, window.hidpi_factor)
        self.text_font_color = Color(255, 255, 255)

        # Template to create new button
        start_btn = Button(window,
                           '[ Start ]',
                           Vector(self.window_center[0] - button_size[0] / 2,
                                  self.window_center[1] - button_size[1]),
                           Vector(*button_size),
                           Color(0, 102, 255),
                           Color(255, 255, 255),
                           Color(0, 80, 230),
                           Color(255, 255, 255),
                           font=button_font)
        start_btn.set_click_handler(self.start)
        self.children.append(start_btn)

        help_btn = Button(window,
                          '[ Help ]',
                          Vector(self.window_center[0] - button_size[0] / 2,
                                 self.window_center[1] + button_size[1]),
                          Vector(*button_size),
                          Color(0, 102, 255),
                          Color(255, 255, 255),
                          Color(0, 80, 230),
                          Color(255, 255, 255),
                          font=button_font)
        help_btn.set_click_handler(self.help)
        self.children.append(help_btn)
Пример #17
0
 def print_data(self):
     """
     Prints out details on the final aligned supermatrix.
     """
     # TODO: make the output of this more useful
     color = Color()
     print(color.blue + "Supermatrix attributes:")
     records = SeqIO.parse(self.file, "fasta")
     num_records = 0
     total_missing = 0
     for record in records:
         otu = record.description
         missing = 0
         for letter in record.seq:
             if letter == '?':
                 missing += 1
                 total_missing += 1
         print(color.yellow + "OTU: " + color.red + otu + color.yellow +
               " % missing data = " + color.red +
               str(round(missing / float(len(record.seq)), 2)))
         num_records += 1
         matrix_length = len(record.seq)
     print(color.blue + "Total number of OTUs = " + color.red +
           str(num_records))
     print(color.blue + "Total length of matrix = " + color.red +
           str(matrix_length))
     print(color.blue + "Taxon coverage density = " + color.red +
           str(self.get_coverage_density()))
     print(color.blue + "Total % missing data = " + color.red +
           str(round(total_missing /
                     float(matrix_length * num_records), 2)) + color.done)
Пример #18
0
    def __init__(self, gb, seq_keys, gb_dir, num_cores, minlength, maxlength, length_thres=0.5, threshold=0.75, evalue=(1.0/10**10)):
        """
        Input: gb dictionary of SeqRecords, keys to all sequences, and an optional threshold for clustering.
        Output: a list of cluster files from UCLUST
        """
        ClusterBuilder.__init__(self, seq_keys)
        self.seq_keys = seq_keys
        self.threshold = threshold
        color = Color()

        if not os.path.exists("uclusters"):
            os.makedirs("uclusters")
        
        # write sequences to fasta
        sequences = []
        for seq_key in seq_keys:
            record = gb[seq_key]
            record.description = record.annotations["organism"] + " " + record.description
            if "sp." not in record.annotations["organism"]:
                sequences.append(record)
        file_name = "_sumac"
        f = open(file_name, "wb")
        SeqIO.write(sequences, f, 'fasta')
        f.close()
        with open("_sumac", "r") as f, open("_sumac_filtered", "w") as fout:
            for l in f:
                if ">" in l:
                    l = l.replace(" ", "_")    
                fout.write(l)

        # call UCLUST
        sort_sequences = ["usearch", "-sortbylength", "_sumac_filtered", "-fastaout", "_sumac_sorted",
                          "-minseqlength", str(minlength), "-maxseqlength", str(maxlength)]
        uclust = ["usearch", "-cluster_fast", "_sumac_sorted", "-id", str(threshold),
                  "-minsl", str(length_thres), "-strand", "both", "-threads", str(num_cores), 
                  "-clusters", "uclusters/", "-fulldp", "-evalue", str(evalue)]
        try:
            subprocess.check_call(sort_sequences)
            subprocess.check_call(uclust)
        except CalledProcessError as e:
            print(color.red + "UCLUST error: " + str(e) + color.done)
            print(color.red + "Trying SLINK instead..." + color.done)
            self.error = True
            return
        except OSError as e:
            print(color.red + "UCLUST is not installed correctly." + color.done)
            print(color.red + "OS error: " + str(e) + color.done)
            print(color.red + "Trying SLINK instead..." + color.done)
            self.error = True
            return
        finally:
            if os.path.exists("_sumac"):
                subprocess.check_call(["rm", "_sumac"])
            if os.path.exists("_sumac_filtered"):
                subprocess.check_call(["rm", "_sumac_filtered"])
            if os.path.exists("_sumac_sorted"):
                subprocess.check_call(["rm", "_sumac_sorted"])
        cluster_files = [ f for f in listdir("uclusters/") if isfile(join("uclusters/", f)) ]
        for f in cluster_files:
            self.clusters.append(f)
Пример #19
0
 def display_heading(self, window):  # pragma: no cover
     window.clear()
     window.border('|', '|', '-', '-', curses.ACS_ULCORNER,
                   curses.ACS_URCORNER, curses.ACS_LLCORNER,
                   curses.ACS_LRCORNER)
     title = 'Level ' + str(self.current_level)
     window.addstr(1, 10, title, Color.use('yellow'))
Пример #20
0
    def __init__(self, gb, seq_keys, length_threshold, gb_dir, num_cores):
        """
        Takes as input a dictionary of SeqRecords gb and the keys to all sequences.
        length_threshold is the threshold of sequence length percent similarity to cluster taxa.
        For example if length_threshold = 0.25, and one sequence has
        length 100, the other sequence must have length 75 to 125. If the lengths are not similar
        enough the distance is set to 50 (which keeps them from being clustered).
        Generates a 2 dimensional list of distances. Distances are blastn e-values.
        """
        lock = multiprocessing.Lock()
        manager = multiprocessing.Manager()
        already_compared = manager.list()
        dist_matrix = manager.list()
        row = []
        for i in range(len(seq_keys)):
            row.append(99)
        for i in range(len(seq_keys)):
            dist_matrix.append(row)

        color = Color()
        print(color.blue + "Spawning " + color.red + str(num_cores) + color.blue + " processes to make distance matrix." + color.done)
        processes = []

        for i in range(num_cores):
            p = multiprocessing.Process(target=self.distance_matrix_worker, args=(seq_keys, length_threshold, dist_matrix, already_compared, lock, i, gb_dir))
            p.start()
            processes.append(p)

        for p in processes:
            p.join()

        sys.stdout.write("\n")
        sys.stdout.flush()
        self.distance_matrix = dist_matrix
Пример #21
0
 def print_PD(self):
     """
     Prints partial decisiveness.
     """
     color = Color()
     print(color.blue + "Partial decisiveness (fraction of triples) = " +
           color.red + str(self.get_PD()) + color.done)
Пример #22
0
    def calculate_PD_parallel(self, num_cores):
        """
        Method to calculate the fraction of triples, a measure of partial decisiveness (PD).
        See: Sanderson, M.J., McMahon, M.M. & Steel, M., 2010. BMC evolutionary biology, 10. 
        """
        color = Color()
        lock = multiprocessing.Lock()
        manager = multiprocessing.Manager()
        #already_compared = manager.list()
        #dist_matrix = manager.list()
        otus_shared = manager.dict()
        otus_shared = otus
        decisive_triples = manager.Value('i', 0)
        total_triples = manager.Value('i', 0)
        total = self.binomial_coefficient(len(self.otus), 3)

        for i in range(num_cores):
            p = multiprocessing.Process(target=calculate_PD_worker,
                                        args=(lock, i, num_cores,
                                              decisive_triples, total_triples,
                                              total, otus_shared))
            p.start()
            processes.append(p)

        for p in processes:
            p.join()

        self.otus = otus_shared

        sys.stdout.write("\r" + color.blue + "Calculating PD: " + color.red +
                         "100.00% " + color.blue + "finished\n" + color.done)
        sys.stdout.flush()
        return round(decisive_triples / float(total_triples), 2)
 def set_rect_fill(*args):
     if args[0] == 0: #surface color mode
         rect = args[1]
         color = args[2]
         qcolor = Color.create_qcolor_from_rgb_tuple_f(color)
         brush = QBrush(qcolor)
         rect.setBrush(brush)
Пример #24
0
    def print_data(self):
        """
        Prints the name of each DNA region, the number of taxa, the aligned length,
        missing data (%), and taxon coverage density
        """
        # first get list of all taxa
        taxa = self.get_all_taxa()

        # print data for each region
        i = 1
        color = Color()
        for alignment in self.files:
            records = list(SeqIO.parse(alignment, "fasta"))
            if self.user_provided:
                region_name = alignment
            else:
                descriptors = records[0].description.split(" ")
                region_name = " ".join(descriptors[5:])
            print(color.blue + "Aligned cluster #: " + color.red + str(i) +
                  color.done)
            print(color.yellow + "DNA region: " + color.red + region_name +
                  color.done)
            print(color.yellow + "OTUs: " + color.red + str(len(records)) +
                  color.done)
            print(color.yellow + "Aligned length: " + color.red +
                  str(len(records[0].seq)) + color.done)
            print(color.yellow + "Missing data (%): " + color.red +
                  str(round(100 -
                            (100 * len(records) / float(len(taxa))), 1)) +
                  color.done)
            print(color.yellow + "Taxon coverage density: " + color.red +
                  str(round(len(records) / float(len(taxa)), 2)) + color.done)
            i += 1
Пример #25
0
 def align_cluster(self, cluster_file):
     """
     Worker fuction for align_clusters
     Inputs a FASTA file containing an unaligned sequence cluster.
     Uses MAFFT to align the cluster.
     """
     mafft_cline = MafftCommandline(input=cluster_file)
     mafft_cline.set_parameter("--auto", True)
     mafft_cline.set_parameter("--adjustdirection", True)
     color = Color()
     print(color.red + str(mafft_cline) + color.done)
     sys.stdout.flush()
     if cluster_file.find("/") != -1:
         alignment_file = "alignments" + cluster_file[cluster_file.index("/"
                                                                         ):]
     else:
         alignment_file = "alignments/" + cluster_file
     try:
         stdout, stderr = mafft_cline()
         with open(alignment_file, "w") as handle:
             handle.write(stdout)
     except:
         print(
             color.red +
             "Error: alignment file not generated. Please check your MAFFT installation."
             + color.done)
     return alignment_file
Пример #26
0
    def __init__(self, world: 'World', pos: Tuple[int, int], size: Tuple[int,
                                                                         int]):
        super().__init__(world)

        self.pos = pos
        self.size = size
        self.color = Color(80, 80, 80)
Пример #27
0
 def print_data(self):
     color = Color()
     print(color.blue + "Name = " + color.red + self.name)
     print(color.blue + "Sequence = " + color.red + self.sequence)
     print(color.blue + "Accessions = " + color.red)
     print(self.accessions)
     print(color.blue + "Sequence_lengths = " + color.red)
     print(self.sequence_lengths)
Пример #28
0
    def __extract_download_urls(self):
        down_base = "https://9anime.to/ajax/episode/info?"
        Color.printer("INFO", "Extracting download URLs...", self.gui)

        for episode in self.episodes:
            if (episode.id is None):
                episode.download_url = None
                continue

            url = down_base + "ts=" + self.ts_no + "&id=" + episode.id + "&server=" + self.server_id
            target = self.session.get(url).json()["target"]

            episode.page_url = target

            download_url = Mp4UploadExtractor(
                target, self.session).extract_direct_url()

            episode.download_url = download_url
Пример #29
0
    def state(self):
        """ Exec state of this component. """
        rect = self.root.find_element_by_css_selector('rect')
        style = Style(rect.get_attribute('style'))
        stroke = Color.from_string(style.stroke)

        # red stroke
        if (stroke == Color(255, 0, 0)):
            return 'INVALID'

        # green stroke
        if (stroke == Color(0, 255, 0)):
            return 'VALID'

        # blue stroke
        if (stroke == Color(0, 0, 255)):
            return 'RUNNING'

        return 'UNKNOWN'
Пример #30
0
 def color(self):  # pragma: no cover
     colors = {
         'floor': 'red',
         'wall': 'magenta',
         'empty': 'black',
         'corridor': 'blue',
         'stairs_down': 'green',
         'stairs_up': 'green'
     }
     return Color.use(colors[self.type])
Пример #31
0
 def print_search_status(self, i, total):
     color = Color()
     sys.stdout.write('\r' + color.yellow + 'Ingroup sequences found: ' \
                       + color.red + str(len(self.ingroup_keys)) + color.yellow \
                       + '  Outgroup sequences found: ' + color.red \
                       + str(len(self.outgroup_keys)) + color.yellow \
                       + '  Percent searched: ' + color.red \
                       + str(round( 100 * float(i) / total , 1)) + color.done
                     )
     sys.stdout.flush()
Пример #32
0
    def download(self):

        try:
            _create_unverified_https_context = ssl._create_unverified_context
        except AttributeError:
            # Legacy Python that doesn't verify HTTPS certificates by default
            pass
        else:
            # Handle target environment that doesn't support HTTPS verification
            ssl._create_default_https_context = _create_unverified_https_context

        Color.printer("INFO", "Downloading started...", self.gui)

        pool = ThreadPool(self.threads, gui)

        pool.map(self.__download_episode, self.episodes)
        pool.wait_completion()

        Color.printer("INFO", "Downloading finished!", self.gui)
Пример #33
0
    def __init__(self, window: Window, source: WindowHandler):
        super().__init__(window)
        self.source = source
        self.levels = self._init_levels()
        self.level = self.levels[0]
        self.player = Player(self)
        self.window = window

        self.text_font = Font('monospace', 16, window.hidpi_factor)
        self.text_font_color = Color(255, 255, 255)
Пример #34
0
def main(start_episode=-1, end_episode=-1, token=None):
    global episodes, download_9anime_url, episodes_url, api_key, gui

    start_episode = int(start_episode)
    end_episode = int(end_episode)

    if not token:
        with open("settings.json") as (json_file):
            data = json.load(json_file)
            api_key = data["api_key"]

    if not download_9anime_url:
        download_9anime_url = input("Anime URL : ")

    if start_episode == -1:
        start_episode = int(input("Enter Start Episode : "))

    if end_episode == -1:
        end_episode = int(input("Enter End Episode : "))

    episodes_url = episodes_url + download_9anime_url.split(".")[2].split(
        "/")[0]

    episodes = extract_page_urls(start_episode, end_episode, token)

    if episodes is None:
        return

    if title_url:
        set_titles(start_episode, end_episode)
    else:
        Color.printer(
            "INFO",
            "animefiller.com URL not provided to collect episode names...",
            gui)
        Color.printer("INFO", "Skipping collecting episode names...", gui)

    extract_download_urls()

    write_data()
 def create_distance_pointer(self):
     self.distance_pointer = QGraphicsLineItem()
     pen = QPen()
     pen.setWidthF(1.0)
     pen.setStyle(Qt.DashDotLine)
     color = Color.create_qcolor_from_rgb_tuple_f((1,0,0))
     pen.setColor(color)
     self.distance_pointer.setPen(pen)
     self.distance_pointer.setZValue(1.0)
     self.addToGroup(self.distance_pointer)
     self.distance_label = QGraphicsSimpleTextItem()
     self.distance_label.setZValue(1.0)
     self.addToGroup(self.distance_label)
Пример #36
0
    def state(self):
        """ Exec state of this component. """
        rect = self.root.find_element_by_css_selector('rect')
        style = Style(rect.get_attribute('style'))
        stroke = Color.from_string(style.stroke)

        #red stroke
        if(stroke == Color(255, 0, 0)):
            return 'INVALID'

        #green stroke
        if(stroke == Color(0, 255, 0)):
            return 'VALID'

        #blue stroke
        if(stroke == Color(0, 0, 255)):
            return 'RUNNING'

        return 'UNKNOWN'
 def init_color_interpolation(self):
     color_start = Color.create_qcolor_from_rgb_tuple(Color.red)
     color_end = Color.create_qcolor_from_rgb_tuple(Color.green)
     self.color_interpolation = ColorInterpolation(color_start, color_end, self.vertical_clearance_min, self.vertical_clearance_max)
 def set_color_picker(self, material):
     button = self.ui.pushButton_colorPicker
     color = material.get_surface_colour()
     self.color_temp = (color[0], color[1], color[2])
     r, g, b = Color.from_factor_to_rgb(color[0], color[1], color[2])
     button.setStyleSheet("background-color: rgb({},{},{})".format(r, g, b))