def get_log(self, out):
        base64image = out

        try:
            raw_data = base64.b64decode(base64image)
            input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
        except:
            # error image
            raw_data = base64.b64decode(
                """iVBORw0KGgoAAAANSUhEUgAAAZAAAAFACAYAAACSgSrjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoWAAsIwyEjnAAAEPhJREFUeNrt3b9uW+cZwOFXhhFAHjPGgzIFCQu4BbQF6SBfgZyhRW7Bvox2ypwhvgR3SZasydAiG4EmQJUgQwEO7ujRKoIg7uDDhpYoiufwO+d8f54HKES0saNSlF6+H3n0iwC2ujg5/eTi5PQT9wRsd+QugGuDIyLi7Yj4vvuvHkTEi8Vq6c6BDXfcBfDm8OgGxZOIuN/958litVwPFsAGAjcOkY8i4u9X/us/LlbLf7h3wACBrdtHHMXdeBXfRcTi6v8cR/H7eBW/OMqC1xxhQWexWka8io+3DI+IiEW8io8ND7CBwLYN5DgiXt7yj91brJaX7i2wgUD88N6H65tf7fGPf3Xlz4ANBBrdOqJ7h9VZRHy95x97uFgtv9l4xxYYINDwIHkZEcd7/uOXi9XynnuN1jnCounto/v4rMfwiIg47v6Ma0OwgUDDQ+R3EfHPiLjb84/+EhF/WKyW/3IvYgOBNn0+YHhE92c+d/dhgECb28dfIuKjA/6Kj7q/A5rkCItWh8f9eP3LEt8+8K96EREPFqvlc/cqNhCoe3Csb36WYHhE93d8duXvBhsIVDpEziPii8R/7aPFavmlexcDBOrdPtadj/uJ//rnoRtCYxxh0czwuNL5SE03BBsIVDxEtnU+UtMNwQCBmraPHZ2P5P863RBa4QiL6t3S+Uj+r9MNwQYC9Wwg+3Q+UtMNwQYCperZ+UhNNwQbCBS6dQzpfKSmG4IBAgUPkj6dj9R0Q6iaIyyq3D66j307H6nphmADgQKHyNDOR2q6IdhAoDBDOx+p6YZggEBB28ehnY/UdEOokiMsahseqTofq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3BZG8j6XVdd5+NrX0+AST1crJbfbLwDtpwBsjFIXoZf1Q4wtcvFanlvzH/BKC+i63wAzG70bsiYR1g6HwDzGrUbMubbeHU+AOY1ajdkrCMsnQ+APIzWDUl+hNX9bvrvw69qB8jFi4h4sFgtn2e5geh8AGRrlG5I0g2k63x84WsFkKVHi9Xyy6wGiM4HQBGSdkMOPsLS+QAoRtJuSKoNROcDoBxJuiEHDZCNzsd34Ve1A5TiIo7i4G7IQUdYOh8ARUrSDTl0A9H5ACjXQd2QQRvID+99uL6p8wFQrq+u/EwfdwPR+QCoyuBuyOAjLJ0PgCoM7ob0OsLS+QCozuBuyJAjLJ0PgLoM6oYMeRFd5wOgLoO6IX2PsHQ+AOrUuxuy9xGWzgdA9Xp1Q27dQHQ+AJrRqxuy1wai8wHQlL26IUd7bB86HwBt2asbcmfX8ND5AGjSXt2Q2zYQnQ+Adu3shhzdtH3ofAA0b2c3ZOsRls4HAHFLN+SmDUTnA4C1rd2QNzYQnQ8AttjaDTna2Dp0PgC4ybVuyLUjLJ0PALa41g25s94+uo86HwBsc60bsnmEpfMBwC5vdEM2X0TX+QBglze6IesjLJ0PAPbx/27Ikc4HAD29iIgHdyLiU8MDgB7ejohP/wdfG3IxFRM1PgAAAABJRU5ErkJggg=="""
            )
            input_stream = Gio.MemoryInputStream.new_from_data(raw_data, None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)

        self.image = Gtk.Image()
        self.image.set_from_pixbuf(pixbuf)
        self.image.show()
        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_hexpand(True)
        scrolledwindow.set_vexpand(True)
        scrolledwindow.add(self.image)
        scrolledwindow.show()

        return scrolledwindow
Exemple #2
0
    def _check_for_banner(self):
        try:
            img_banner, url = get_event_banner()
            if img_banner is not None:
                input_stream = Gio.MemoryInputStream.new_from_data(img_banner, None)
                pixbuf = Pixbuf.new_from_stream(input_stream, None)
                image = Gtk.Image()
                image.show()
                image.set_from_pixbuf(pixbuf)

                def open_web(*args):
                    webbrowser.open_new_tab(url)

                def cursor_change(w: Gtk.Widget, evt: Gdk.EventCrossing):
                    cursor = None
                    if evt.get_event_type() == Gdk.EventType.ENTER_NOTIFY:
                        cursor = Gdk.Cursor.new_from_name(w.get_display(), "pointer")
                    elif evt.get_event_type() == Gdk.EventType.LEAVE_NOTIFY:
                        cursor = Gdk.Cursor.new_from_name(w.get_display(), "default")
                    if cursor:
                        w.get_window().set_cursor(cursor)
                b_info = self.builder.get_object('banner_info')
                b_info.connect('button-release-event', open_web)
                b_info.connect('enter-notify-event', cursor_change)
                b_info.connect('leave-notify-event', cursor_change)
                b_info.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
                b_info.add(image)
                return
        except Exception:
            pass
        # else/except:
        self.builder.get_object('banner_info').hide()
    def open(self, *args):
        search = Search()
        links = search.search(self.entry.get_text())

        self.grid_helper.refresh()

        for link in links:
            url = link.img
            text = Gtk.Label(link.title)

            #text.set_size_request(50, 50)
            text.set_line_wrap(True)
            response = urllib2.urlopen(url)
            input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            image = Gtk.Image()
            image.set_from_pixbuf(pixbuf)

            box = Gtk.VBox()
            box.pack_start(image, False, False, 0)
            box.pack_start(text, False, False, 0)
            event_box = Gtk.EventBox()
            event_box.add(box)

            event_box.connect("button-press-event", self.serie_clicked, link)

            self.grid_helper.add_widget(event_box)

        self.grid_helper.load_widgets()
        self.window.show_all()
Exemple #4
0
    def search_worker(self, query):
        try:
            self.extmgr.search(query)
        except Exception as error:
            GLib.idle_add(self.show_error, error)
            GLib.idle_add(self.restore_search_button)

        for index, result in enumerate(self.extmgr.results):
            # Download the image into a buffer and render it with pixbuf
            try:
                img_buffer = self.extmgr.get_image(self.extmgr.get_uuid(index))
            except Exception as error:
                GLib.idle_add(self.show_error, error)
                GLib.idle_add(self.restore_search_button)

            # Check if the extension icon is local (faster searching)
            if img_buffer == None:
                pixbuf = Pixbuf.new_from_file(
                    os.path.join(os.path.dirname(__file__), "plugin.png"))
            else:
                img_buffer = Gio.MemoryInputStream.new_from_data(
                    img_buffer, None)
                pixbuf = Pixbuf.new_from_stream(img_buffer, None)
                pixbuf = pixbuf.scale_simple(32, 32, InterpType.BILINEAR)
            self.extmgr.results[index]["pixbuf"] = pixbuf
        GLib.idle_add(self.display_search_results)
Exemple #5
0
    def get_url(self):
        req = urllib.request.Request(self.url)
        req.add_header('Referer',
                       'https://streamkit.discord.com/overlay/voice')
        req.add_header('User-Agent', 'Mozilla/5.0')
        try:
            response = urllib.request.urlopen(req)
            input_stream = Gio.MemoryInputStream.new_from_data(
                response.read(), None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            if self.size:
                pixbuf = pixbuf.scale_simple(self.size, self.size,
                                             GdkPixbuf.InterpType.BILINEAR)
            # elif self.limit_x or self.limit_y:
            #    px = pixbuf.width()
            #    py = pixbuf.height()
            #    aspect = px / py
            #    scale = 1.0
            #    if self.limit_x and self.limit_y:
            #        scale = min(self.limit_x / px, self.limit_y / py, 1.0)
            #    elif self.limit_x:
            #        scale = min(self.limit_x / px, 1.0)
            #    elif self.limit_y:
            #        scale = min(self.limit_y / py, 1.0)##


#
#                pixbuf = pixbuf.scale_simple(int(px * scale), int(py * scale),
#                                             GdkPixbuf.InterpType.BILINEAR)

            self.func(self.id, pixbuf)
        except Exception as e:
            logging.error("Could not access : %s" % (self.url))
            logging.error(e)
Exemple #6
0
    def search_worker(self, query):
        try:
            self.extmgr.search_web(query)
        except Exception as error:
            GLib.idle_add(self.show_error, error)
            GLib.idle_add(self.restore_search_button)

        for item in self.extmgr.search_results:
            # Download the image into a buffer and render it with pixbuf
            try:
                img_buffer = self.extmgr.get_remote_image(item["uuid"])
            except Exception as error:
                img_buffer = None
                GLib.idle_add(self.show_error, error)
                GLib.idle_add(self.restore_search_button)

            # Check if the extension icon is local (faster searching)
            if img_buffer == None:
                pixbuf = self.default_icon_pixbuf
            else:
                img_buffer = Gio.MemoryInputStream.new_from_data(img_buffer, None)
                try:
                    pixbuf = Pixbuf.new_from_stream(img_buffer, None)
                    pixbuf = pixbuf.scale_simple(32, 32, InterpType.BILINEAR)
                except Exception as error:
                    pixbuf = self.default_icon_pixbuf
            item["pixbuf"] = pixbuf
        GLib.idle_add(self.display_search_results)
Exemple #7
0
def get_gravatar_img_as_pixbuf(email):
    size = 40
    h = hashlib.md5(email.lower().encode("utf-8")).hexdigest()
    url = f"https://www.gravatar.com/avatar/{h}?d={size}"
    response = urllib.request.urlopen(url)
    input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None)
    pixbuf = Pixbuf.new_from_stream(input_stream, None)
    return pixbuf
Exemple #8
0
	def call_end(self, screen):
		self.emit('end_task', screen)
		
		try:
			self.image.set_from_pixbuf( Pixbuf.new_from_stream(Gio.MemoryInputStream.new_from_data(base64.b64decode(screen), None) , None) )
		except: pass
		
		return False
Exemple #9
0
	def load_image_from_url(self, target, url):
		image = self.builder.get_object(target)
		if not image:
			return

		response = urllib.request.urlopen(url)
		input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None)
		pixbuf = Pixbuf.new_from_stream(input_stream, None)
		image.set_from_pixbuf(pixbuf)
 def _tab_icon_ready(self, url, contents):
     try:
         input_stream = Gio.MemoryInputStream.new_from_data(contents, None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
     except Exception as ex:
         print "Error fetching icon for URL '%s': %s" % (url, ex.message)
         return
     self._icon_cache[url] = pixbuf
     self._update_tab_icon_callback(url, contents)
Exemple #11
0
    def __get_image_thread(self, url: str, callback, cache, userdata=None):

        # standardize all URLs
        if not url.startswith("https:"):
            url = "https:" + url

        # look into cache
        cached = self.__image_dict.get(url, None)
        if cached:
            _thread.start_new_thread(callback, (cached, userdata))
            return

        # no one is allowed to look inside fetching_dict
        self.__sem.acquire()

        # look into cache again
        cached = self.__image_dict.get(url, None)
        if cached:
            self.__sem.release()
            callback(cached, userdata)
            return

        # see if someone else is working
        do_the_work = len(self.__fetching_dict) == 0

        work = (callback, userdata, cache)
        url_list = self.__fetching_dict.get(url, list())
        url_list.append(work)
        self.__fetching_dict[url] = url_list

        self.__sem.release()

        # return if someone else needs to do the work
        if not do_the_work:
            return

        # iterate through all urls
        while len(self.__fetching_dict):
            # get first key
            url = next(iter(self.__fetching_dict))

            # request image
            response = requests.get(url)
            input_stream = Gio.MemoryInputStream.new_from_data(
                response.content, None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            input_stream.close()

            self.__sem.acquire()
            # pass image to every callback
            for (callback, userdata, cache) in self.__fetching_dict.get(url):
                if cache:
                    self.__image_dict[url] = pixbuf
                _thread.start_new_thread(callback, (pixbuf, userdata))
            del self.__fetching_dict[url]
            self.__sem.release()
Exemple #12
0
    def downloadPixbufAlbumCover(url):
        if debug:
            print("downloading album cover from " + url)

        f = File.new_for_uri(url)
        stream = f.read()

        cover = Pixbuf.new_from_stream(stream)
        stream.close()
        return cover
 def set_picture(self, url):
     response = urllib2.urlopen(url) 
     input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None) 
     pixbuf = Pixbuf.new_from_stream(input_stream, None) 
     image = Gtk.Image() 
     image.set_from_pixbuf(pixbuf)
     image.set_pixel_size(50)
     #image = Gtk.Image.new_from_file(image);
     #self.chatbox.draw
     self.grid.attach(image, 3, 1,1,1);
Exemple #14
0
 def _tab_icon_ready(self, url, contents):
     try:
         input_stream = Gio.MemoryInputStream.new_from_data(contents, None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
     except:
         print(traceback.format_exc())
         print("Error generating icon from {}".format(url))
         return
     self._icon_cache[url] = pixbuf
     self._update_tab_icon_callback(url, contents)
 def _tab_icon_ready(self, url, contents):
     input_stream = Gio.MemoryInputStream.new_from_data(contents, None)
     try:
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
     except GLib.Error as ex:
         if ex.message == 'Unrecognized image file format':
             print "Error fetching icon for URL '%s': %s" % (url,
                                                             ex.message)
             return
     self._icon_cache[url] = pixbuf
     self._update_tab_icon_callback(url, contents)
Exemple #16
0
 def load_thumbnail(self):
     if self.gamesdb_info["cover"]:
         response = urllib.request.urlopen(self.gamesdb_info["cover"])
         input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
         pixbuf = pixbuf.scale_simple(340, 480, InterpType.BILINEAR)
         GLib.idle_add(self.image.set_from_pixbuf, pixbuf)
     else:
         thumbnail_path = os.path.join(THUMBNAIL_DIR, "{}.jpg".format(self.game.id))
         if not os.path.isfile(thumbnail_path) and self.game.is_installed:
             thumbnail_path = os.path.join(self.game.install_dir, "thumbnail.jpg")
         GLib.idle_add(self.image.set_from_file, thumbnail_path)
Exemple #17
0
 def get_avatar_img_as_pixbuf(self, mode="file"):
     if mode == "stream":
         url = self.data["avatar_url"]
         response = urllib.request.urlopen(url)
         input_stream = Gio.MemoryInputStream.new_from_data(
             response.read(), None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
     elif mode == "file":
         pixbuf = Pixbuf.new_from_file_at_size(
             self.get_avatar_img_file_path(),
             self.USER_AVATAR_SIZE,
             self.USER_AVATAR_SIZE,
         )
     return pixbuf
Exemple #18
0
def get_image_stream(url):
    pixbuf = None
    if "nochannel.png" in url:
        pixbuf = Pixbuf.new_from_file(url)
    else:
        response = urllib.request.urlopen(url)
        input_stream = Gio.MemoryInputStream.new_from_data(
            response.read(), None)
        pixbuf = Pixbuf.new_from_stream(input_stream, None)
    width = pixbuf.get_width()
    width_perc = (100 * 100) / width
    height = (pixbuf.get_height() * width_perc) / 100
    pixbuf = pixbuf.scale_simple(100, height, InterpType.BILINEAR)
    return pixbuf
Exemple #19
0
 def _load_support_images(self):
     # Load the Discord badge
     try:
         raise Exception("Disabled for now.")
         url = 'https://raster.shields.io/discord/710190644152369162?label=Discord'
         req = urllib.request.Request(url,
                                      headers={'User-Agent': 'Mozilla/5.0'})
         # Some weird issue on Windows with PyInstaller...:
         ctx = ssl.create_default_context()
         ctx.check_hostname = False
         ctx.verify_mode = ssl.CERT_NONE
         input_stream = Gio.MemoryInputStream.new_from_data(
             urllib.request.urlopen(req, context=ctx, timeout=1).read(),
             None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
         image = Gtk.Image()
         image.show()
         image.set_from_pixbuf(pixbuf)
         self.builder.get_object('discord_icon_container').add(image)
     except BaseException:
         # We are not crashing over a Discord badge...
         logger.error("Failed loading the Discord badge.",
                      exc_info=sys.exc_info())
     # Load the support us images
     try:
         # Discord
         image = Gtk.Image()
         image.show()
         image.set_from_file(os.path.join(data_dir(), "discord.png"))
         self.builder.get_object('suppot_us_discord_container').add(image)
         # Github
         image = Gtk.Image()
         image.show()
         image.set_from_file(os.path.join(data_dir(), "github.png"))
         self.builder.get_object('suppot_us_github_container').add(image)
         # Kofi
         image = Gtk.Image()
         image.show()
         image.set_from_file(os.path.join(data_dir(), "kofi.png"))
         self.builder.get_object('suppot_us_kofi_parakoopa_container').add(
             image)
         # Kofi 2
         image = Gtk.Image()
         image.show()
         image.set_from_file(os.path.join(data_dir(), "kofi.png"))
         self.builder.get_object('suppot_us_kofi_psy_container').add(image)
     except BaseException:
         # We are not crashing over some images...
         pass
Exemple #20
0
    def pixbuf_from_bytes(b, width, height):
        """Создаёт и возвращает экземпляр Gdk.Pixbuf.

        b       - экземпляр GLib.Bytes с данными в формате PNG/JPG/...,
        width,
        height  - целые, размеры изображения в пикселах, если нужен
                  определённый размер;
                  для загрузки "как есть" следует указывать значения
                  <=0 или None."""

        if isinstance(width, int) and width > 0:
            return Pixbuf.new_from_stream_at_scale(Gio.MemoryInputStream.new_from_bytes(b),
                    width, height, None)
        else:
            return Pixbuf.new_from_stream(Gio.MemoryInputStream.new_from_bytes(b), None)
 def get_img(self, url):
     req = urllib.request.Request(url)
     req.add_header('Referer',
                    'https://streamkit.discord.com/overlay/voice')
     req.add_header('User-Agent', 'Mozilla/5.0')
     try:
         response = urllib.request.urlopen(req)
         input_stream = Gio.MemoryInputStream.new_from_data(
             response.read(), None)
         pixbuf = Pixbuf.new_from_stream(input_stream, None)
         pixbuf = pixbuf.scale_simple(self.avatar_size, self.avatar_size,
                                      GdkPixbuf.InterpType.BILINEAR)
         return pixbuf
     except:
         print("Could not access : %s" % (url))
     return none
Exemple #22
0
    def show_results(self):
        # Disable search button while searching
        self.searchbutton.set_sensitive(False)
        self.searchbutton.set_label("Searching...")

        # Clear old entries
        for entry in self.listbox1.get_children():
            self.listbox1.remove(entry)

        # Disable install button until you have something selected
        self.installbutton.set_sensitive(False)

        # Refresh results and populate list
        self.extmgr.search(self.entry.get_text())
        for index, result in enumerate(self.extmgr.results):

            # Create a box for each item
            resultbox = Gtk.HBox()
            name_label = Gtk.Label(label=result["name"])
            name_label.set_halign(1)

            # Download the image into a buffer and render it with pixbuf
            img_buffer = self.extmgr.get_image(self.extmgr.get_uuid(index))
            img_buffer = Gio.MemoryInputStream.new_from_data(img_buffer, None)
            pixbuf = Pixbuf.new_from_stream(img_buffer, None)
            pixbuf = pixbuf.scale_simple(32, 32, InterpType.BILINEAR)

            img = Gtk.Image()
            img.set_from_pixbuf(pixbuf)
            img.set_halign(1)

            resultbox.pack_start(img, True, True, 0)
            resultbox.pack_end(name_label, True, True, 0)

            listboxrow = Gtk.ListBoxRow()
            listboxrow.add(resultbox)
            self.listbox1.add(listboxrow)

        # Display after refresh
        self.listbox1.show_all()
        self.show_all()

        # Reenable search button
        self.searchbutton.set_sensitive(True)
        self.searchbutton.set_label("Search!")
Exemple #23
0
    def draw_avatar(self, context, user, y):
        # Ensure pixbuf for avatar
        if user["id"] not in self.avatars and user["avatar"]:
            url = "https://cdn.discordapp.com/avatars/%s/%s.jpg" % (
                user["id"], user["avatar"])
            req = urllib.request.Request(url)
            req.add_header('Referer',
                           'https://streamkit.discord.com/overlay/voice')
            req.add_header('User-Agent', 'Mozilla/5.0')
            try:
                response = urllib.request.urlopen(req)
                input_stream = Gio.MemoryInputStream.new_from_data(
                    response.read(), None)
                pixbuf = Pixbuf.new_from_stream(input_stream, None)
                pixbuf = pixbuf.scale_simple(self.avatar_size,
                                             self.avatar_size,
                                             GdkPixbuf.InterpType.BILINEAR)
                self.avatars[user["id"]] = pixbuf
            except:
                print("Could not access : %s" % (url))

        (w, h) = self.get_size()
        c = None
        mute = False
        alpha = 1.0
        if "speaking" in user and user["speaking"]:
            c = self.talk_col
        if "mute" in user and user["mute"]:
            mute = True
        if "deaf" in user and user["deaf"]:
            alpha = 0.5
        pix = None
        if user["id"] in self.avatars:
            pix = self.avatars[user["id"]]
        if self.align_right:
            self.draw_text(context, user["username"], w - self.avatar_size, y)
            self.draw_avatar_pix(context, pix, w - self.avatar_size, y, c,
                                 alpha)
            if mute:
                self.draw_mute(context, w - self.avatar_size, y, alpha)
        else:
            self.draw_text(context, user["username"], self.avatar_size, y)
            self.draw_avatar_pix(context, pix, 0, y, c, alpha)
            if mute:
                self.draw_mute(context, 0, y, alpha)
Exemple #24
0
 def update(self, status, visibility):
     self.visible = visibility
     if self.visible:
         shuffle = status.get('shuffle', 0)
         if shuffle:
             self.shuffle = 'media-playlist-shuffle-symbolic'
         else:
             self.shuffle = None
         repeat = status.get('repeat', 0)
         self.repeat = self._repeat_list[repeat]
         self.play = status.get('play', 0)
         if self.play == 2:
             self.play_icon = 'media-playback-pause-symbolic'
         else:
             self.play_icon = 'media-playback-start-symbolic'
         lines = status.get('lines', {})
         self.title = lines.get(1, {}).get('value', None)
         self.artist = lines.get(2, {}).get('value', None)
         self.album = lines.get(3, {}).get('value', None)
         self.encoding = lines.get(4, {}).get('value', None)
         self.sampling = lines.get(5, {}).get('value', None)
         self.resolution = lines.get(6, {}).get('value', None)
         self.elapsed_time = lines.get(7, {}).get('value', None)
         if self.elapsed_time:
             splitted = self.elapsed_time.split(':')
             self.elapsed_time = timedelta(minutes=int(splitted[0]),
                                           seconds=int(splitted[1]))
         self.duration = lines.get(8, {}).get('value', None)
         if self.duration:
             splitted = self.duration.split(':')
             self.duration = timedelta(minutes=int(splitted[0]),
                                       seconds=int(splitted[1]))
         url = status.get('url', None)
         if url:
             response = urlopen(url)
             input_stream = Gio.MemoryInputStream.new_from_data(
                 response.read(), None)
             try:
                 self.pixbuf = Pixbuf.new_from_stream(input_stream, None)
             except:
                 log_error(
                     "Error : cannot use input stream to load picture")
         else:
             self.pixbuf = None
    def __init__(self, query):
        self.query = query

        image_url = \
            "http://gatherer.wizards.com/Handlers/Image.ashx?type=card&name=%s" % \
            self.query
        self.split = False
        # rotate split cards
        if '//' in self.query:
            self.split = True
            image_url= '%s&options=rotate90' % image_url
        image_raw = get(image_url).content
        input_stream = Gio.MemoryInputStream.new_from_data(image_raw, None)
        self.pixbuf = Pixbuf.new_from_stream(input_stream, None)

        # handle split cards
        html_url = \
            "http://gatherer.wizards.com/Pages/Card/Details.aspx?name=%s" % \
            re.sub("(.*) // (.*)", r"[\1]+[//]+[\2]", self.query)
        html = get(html_url).text
        self.dom = parse(html, treebuilder='etree', namespaceHTMLElements=False)
Exemple #26
0
def bytes_to_pixbuf(raw: bytes) -> Pixbuf:
    glib_bytes = GLib.Bytes.new(raw)
    stream = Gio.MemoryInputStream.new_from_bytes(glib_bytes)
    return Pixbuf.new_from_stream(stream)
 def set_albumart(self):
     inputStream = Gio.MemoryInputStream \
         .new_from_data(self.albumart_data, None)
     pixbuf = Pixbuf.new_from_stream(inputStream, None)
     pixbuf = pixbuf.scale_simple(180, 180, InterpType.BILINEAR)
     GLib.idle_add(self.apply_albumart, pixbuf)
Exemple #28
0
    def __init__(self, parent, title, info, extra_info):
        """Create the dialog."""

        # Create the dialog.
        Gtk.Dialog.__init__(self, title, parent, Gtk.DialogFlags.MODAL)
        self.set_default_size(500, -1)
        self.add_button("View Profile", DialogResponse.VIEW_PROFILE)

        # Create the avatar image.
        dlg_box = self.get_content_area()
        avatar_img = Gtk.Image()
        try:
            response = urllib2.urlopen(info["avatar_url"])
            input_stream = Gio.MemoryInputStream.new_from_data(
                response.read(), None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            avatar_img.set_from_pixbuf(pixbuf)
        except urllib2.URLError:
            pass
        avatar_img.props.halign = Gtk.Align.CENTER
        avatar_img.set_hexpand(True)
        dlg_box.add(avatar_img)

        # Create the labels.
        name_lbl = Gtk.Label()
        name_lbl.set_markup(
            "<span size=\"xx-large\"><a href=\"https://pastebin.com/u/" +
            info["name"] + "\">" + info["name"] + "</a></span>")
        name_lbl.set_margin_top(10)
        dlg_box.add(name_lbl)
        account_lbl = Gtk.Label()
        account_lbl.set_markup("<span size=\"medium\">" +
                               ACCOUNT_TYPE[info["account_type"]] +
                               " account</span>")
        account_lbl.set_margin_top(5)
        dlg_box.add(account_lbl)
        if len(extra_info) > 0:
            join_lbl = Gtk.Label()
            join_lbl.set_markup("<span size=\"medium\">Joined " +
                                " ".join(extra_info[2][1].split(" ")[0:5]) +
                                "</span>")
            join_lbl.set_margin_top(5)
            dlg_box.add(join_lbl)
        email_lbl = Gtk.Label()
        email_lbl.set_markup("<span size=\"medium\"><a href=\"mailto:" +
                             info["email"] + "\">" + info["email"] +
                             "</a></span>")
        email_lbl.set_margin_top(10)
        dlg_box.add(email_lbl)
        website_lbl = Gtk.Label()
        if info["website"]:
            website_lbl.set_markup("<span size=\"medium\"><a href=\"" +
                                   info["website"] + "\">" + info["website"] +
                                   "</a></span>")
        else:
            website_lbl.set_markup(
                "<span size=\"medium\">No website provided</span>")
        website_lbl.set_margin_top(5)
        dlg_box.add(website_lbl)
        location_lbl = Gtk.Label()
        if info["location"]:
            location_lbl.set_markup("<span size=\"medium\">Located at " +
                                    info["location"] + "</span>")
        else:
            location_lbl.set_markup(
                "<span size=\"medium\">No location provided</span>")
        location_lbl.set_margin_top(5)
        dlg_box.add(location_lbl)
        if len(extra_info) > 0:
            profile_view_lbl = Gtk.Label()
            profile_view_lbl.set_markup("<span size=\"medium\">" +
                                        extra_info[0][1] +
                                        " profile views</span>")
            profile_view_lbl.set_margin_top(10)
            dlg_box.add(profile_view_lbl)
            paste_view_lbl = Gtk.Label()
            paste_view_lbl.set_markup("<span size=\"medium\">" +
                                      extra_info[1][1] +
                                      " total paste views</span>")
            paste_view_lbl.set_margin_top(5)
            dlg_box.add(paste_view_lbl)

        # Show the dialog.
        self.show_all()
    def __init__(self, parent, title, info, extra_info):
        """Create the dialog."""

        # Create the dialog.
        Gtk.Dialog.__init__(self, title, parent, Gtk.DialogFlags.MODAL)
        self.set_default_size(500, -1)
        self.add_button("View Profile", DialogResponse.VIEW_PROFILE)

        # Create the avatar image.
        dlg_box = self.get_content_area()
        avatar_img = Gtk.Image()
        try:
            response = urllib2.urlopen(info["avatar_url"])
            input_stream = Gio.MemoryInputStream.new_from_data(response.read(), None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            avatar_img.set_from_pixbuf(pixbuf)
        except urllib2.URLError:
            pass
        avatar_img.props.halign = Gtk.Align.CENTER
        avatar_img.set_hexpand(True)
        dlg_box.add(avatar_img)

        # Create the labels.
        name_lbl = Gtk.Label()
        name_lbl.set_markup("<span size=\"xx-large\"><a href=\"https://pastebin.com/u/" + info["name"] + "\">" + info["name"] + "</a></span>")
        name_lbl.set_margin_top(10)
        dlg_box.add(name_lbl)
        account_lbl = Gtk.Label()
        account_lbl.set_markup("<span size=\"medium\">" + ACCOUNT_TYPE[info["account_type"]] + " account</span>")
        account_lbl.set_margin_top(5)
        dlg_box.add(account_lbl)
        if len(extra_info) > 0:
            join_lbl = Gtk.Label()
            join_lbl.set_markup("<span size=\"medium\">Joined " + " ".join(extra_info[2][1].split(" ")[0:5]) + "</span>")
            join_lbl.set_margin_top(5)
            dlg_box.add(join_lbl)
        email_lbl = Gtk.Label()
        email_lbl.set_markup("<span size=\"medium\"><a href=\"mailto:" + info["email"] + "\">" + info["email"] + "</a></span>")
        email_lbl.set_margin_top(10)
        dlg_box.add(email_lbl)
        website_lbl = Gtk.Label()
        if info["website"]:
            website_lbl.set_markup("<span size=\"medium\"><a href=\"" + info["website"] + "\">" + info["website"] + "</a></span>")
        else:
            website_lbl.set_markup("<span size=\"medium\">No website provided</span>")
        website_lbl.set_margin_top(5)
        dlg_box.add(website_lbl)
        location_lbl = Gtk.Label()
        if info["location"]:
            location_lbl.set_markup("<span size=\"medium\">Located at " + info["location"] + "</span>")
        else:
            location_lbl.set_markup("<span size=\"medium\">No location provided</span>")
        location_lbl.set_margin_top(5)
        dlg_box.add(location_lbl)
        if len(extra_info) > 0:
            profile_view_lbl = Gtk.Label()
            profile_view_lbl.set_markup("<span size=\"medium\">" + extra_info[0][1] + " profile views</span>")
            profile_view_lbl.set_margin_top(10)
            dlg_box.add(profile_view_lbl)
            paste_view_lbl = Gtk.Label()
            paste_view_lbl.set_markup("<span size=\"medium\">" + extra_info[1][1] + " total paste views</span>")
            paste_view_lbl.set_margin_top(5)
            dlg_box.add(paste_view_lbl)

        # Show the dialog.
        self.show_all()
Exemple #30
0
 def set_proper_dlc_icon(self, source, async_res, user_data):
     response = source.read_finish(async_res)
     pixbuf = Pixbuf.new_from_stream(response)
     self.dlc_dict[user_data][1].set_from_pixbuf(pixbuf)
Exemple #31
0
    def on_instance_view_row_activated(self, view, row_index, column):
        print("on_instance_view_row_activated:", view, " row_index:",
              row_index)

        # clear in reverse order
        self.clear_current_image_and_pixel_data()

        model, treeiter = view.get_selection().get_selected_rows()
        self.sop_instance_uid = model[row_index][0]
        if True:
            # TODO visually present more parts of:
            instance_metadata = self.client.retrieve_instance_metadata(
                study_instance_uid=self.study_instance_uid,
                series_instance_uid=self.series_instance_uid,
                sop_instance_uid=self.sop_instance_uid)[0]
            self.image_height = try_get_attr(instance_metadata,
                                             '00280010')  # rows
            self.image_width = try_get_attr(instance_metadata,
                                            '00280011')  # columns
            self.image_bits_per_pixel = try_get_attr(
                instance_metadata, '00280100')  # bits per pixel
            self.frame_count = try_get_attr(
                instance_metadata, '00280008', '1'
            )  # only present for multi-frame image instances so default to 1
            transfer_syntax_uid = try_get_attr(instance_metadata, '00020010')
            if transfer_syntax_uid is not None:
                transfer_type = DICOM_TRANSFER_SYNTAXES[transfer_syntax_uid]

            image_format = None  # possible values are None (uncompressed/raw), 'jpeg', or 'jp2'
            try:
                start = time.time()
                frames = self.client.retrieve_instance_frames(
                    study_instance_uid=self.study_instance_uid,
                    series_instance_uid=self.series_instance_uid,
                    sop_instance_uid=self.sop_instance_uid,
                    frame_numbers=[1],
                    image_format=image_format)
                stop = time.time()
                print("Retrieving frame took {}".format(stop - start))
            except requests.exceptions.HTTPError:
                frames = []  # no frames
                pass

            # need to store frames because Pixbuf.new_from_data doesn't keep own
            # reference to data so Python will destroy it without Gtk knowing about it
            self.rgb_frames = len(frames) * [None]

            for image_index, frame in enumerate(frames):
                pixel_count = (self.image_width * self.image_height)
                rgb_frame_temp = bytearray(
                    3 * pixel_count)  # pre-allocate RGB pixels

                if image_format is None:  # raw pixels
                    start = time.time()
                    if self.image_bits_per_pixel == 8:
                        for j in range(0, pixel_count):
                            grey8 = frame[j]
                            rgb_frame_temp[3 * j + 0] = grey8
                            rgb_frame_temp[3 * j + 1] = grey8
                            rgb_frame_temp[3 * j + 2] = grey8
                    if self.image_bits_per_pixel == 16:
                        for j in range(0, pixel_count):
                            # 16-bit grey pixel value
                            grey16 = (256 * frame[2 * j + 1] +
                                      frame[2 * j + 0])
                            grey8 = int(grey16 /
                                        128)  # 16-bit to 8-bit conversion
                            rgb_frame_temp[3 * j + 0] = grey8
                            rgb_frame_temp[3 * j + 1] = grey8
                            rgb_frame_temp[3 * j + 2] = grey8
                    else:
                        raise Exception("Cannot handle bits_per_pixel being" +
                                        str(self.image_bits_per_pixel))
                    stop = time.time()
                    print("Converting frame to grey-scale RGB-image took {}".
                          format(stop - start))

                    # Ref: https://lazka.github.io/pgi-docs/#GdkPixbuf-2.0/classes/Pixbuf.html#GdkPixbuf.Pixbuf.new_from_data
                    # this better than `Pixbuf.new_from_bytes` which requires
                    # the data parameter to be wrapped in a GLib.Bytes object

                    # WARNING: be aware of that `new_from_data` is buggy. See for instance:
                    # https://stackoverflow.com/questions/29501835/gtk3-gdk-pixbuf-new-from-data-gives-segmentation-fault-core-dumped-error-13
                    start = time.time()
                    self.rgb_frames[image_index] = bytes(
                        rgb_frame_temp
                    )  # bytearray needs to be wrapped in a `bytes` and store here in order to enot loose ref
                    pixbuf = Pixbuf.new_from_data(
                        self.rgb_frames[image_index],  # data
                        Colorspace.RGB,  # colorspace
                        False,  # has_alpha
                        8,  # bits_per_sample
                        self.image_width,  # width
                        self.image_height,  # height
                        self.image_width *
                        3,  # rowstride, 3 because RGB has 3 bytes per pixel
                        None,
                        None)  # rely on Python for deallocation
                    if image_index == 0:
                        self.image_view.set_from_pixbuf(pixbuf)
                    stop = time.time()
                    print("Display image took {}".format(stop - start))
                elif image_format == 'jp2':
                    print("TODO Decode jp2 image...")
                    if False:
                        input_stream = Gio.MemoryInputStream.new_from_data(
                            frame, None)
                        pixbuf = Pixbuf.new_from_stream(input_stream, None)
                        if image_index == 0:
                            self.image_view.set_from_pixbuf(pixbuf)
Exemple #32
0
 def idle(input_stream):
     pixbuf = Pixbuf.new_from_stream(input_stream, None)
     popover.add_image(pixbuf, id)
Exemple #33
0
def pixbuf_from_url(url):
    image_data = urllib.request.urlopen(url)
    input_stream = Gio.MemoryInputStream.new_from_data(image_data.read(), None)
    pixbuf = Pixbuf.new_from_stream(input_stream, None)
    return pixbuf
    def iniciarCliente(self):
        builder = Gtk.Builder()
        builder.add_from_file("modules/GTKStructure/ventanaCliente.glade"
                              )  #creo la interface Gtk

        self.listbo = builder.get_object("listbo")
        self.listbo2 = builder.get_object("listbo2")

        anilistApi = AnilistReq.AnilistaRequest()
        anilistApi.actualizar()
        lista_anime_emision = anilistApi.obtenerListaEnEmision()
        lista_anime_offseason = anilistApi.obtenerListaOffSeason()
        datos_usr = anilistApi.obtenerDatosdeUsuario()

        imgdata = anilistApi.obtenerAvatar()  #data byte img
        input_stream = Gio.MemoryInputStream.new_from_data(imgdata, None)
        pixbuf = Pixbuf.new_from_stream(input_stream, None)
        self.gtkimag = builder.get_object("avatar")
        self.gtkimag.set_from_pixbuf(pixbuf)

        self.labelprofilename = builder.get_object("labelprofilename")
        self.labelprofilename.set_text(datos_usr['profilename'])

        self.scrollwin = builder.get_object("scrollwindow")
        self.scrollwin.set_name("scrollwin")
        self.scrollwin = builder.get_object("scrollwindow2")
        self.scrollwin.set_name("scrollwin2")

        corrimientovent = 135

        labelvistos = builder.get_object("total_cont")
        labelvistos.set_text(str(datos_usr['vistos']))
        labelepi = builder.get_object("episodios_cont")
        labelepi.set_text(str(datos_usr['episodios']))
        labeldias = builder.get_object("dias_cont")
        labeldias.set_text(str(datos_usr['dias']))
        labelsig = builder.get_object("siguiendo")
        labelsig.set_text(str(len(lista_anime_emision)))
        labelvie = builder.get_object("viendo")
        labelvie.set_text(str(len(lista_anime_offseason)))

        for elem in lista_anime_offseason:

            input_stream = Gio.MemoryInputStream.new_from_data(
                elem['coverimg'], None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            gtkimag = Gtk.Image()
            gtkimag.set_from_pixbuf(pixbuf)

            contenedorenlista = Gtk.Fixed()

            contenedorenlista.put(gtkimag, 20, 0)

            titulo_content = Gtk.Label()
            titulo_content.set_text(elem['titulo'])
            titulo_content.set_name("labelama")

            contenedorenlista.put(titulo_content, 0 + corrimientovent, 0)

            temporada = Gtk.Label()
            temporada.set_text("Temporada:")

            temporada_content = Gtk.Label()
            temporada_content.set_text(elem['temporada'] + " " +
                                       str(elem['anio']))
            temporada_content.set_name("labelblue")

            contenedorenlista.put(temporada, 0 + corrimientovent, 20)
            contenedorenlista.put(temporada_content, 85 + corrimientovent, 20)

            progreso = Gtk.Label()
            progreso.set_text("Progreso:")

            progreso_content = Gtk.Label()
            progreso_content.set_text("[" + str(elem['progreso']) + "/" +
                                      str(elem['totepisodios']) + "]")
            progreso_content.set_name("labelverd")

            contenedorenlista.put(progreso, 0 + corrimientovent, 40)
            contenedorenlista.put(progreso_content, 80 + corrimientovent, 40)

            self.listbo2.add(contenedorenlista)

        for elem in lista_anime_emision:

            input_stream = Gio.MemoryInputStream.new_from_data(
                elem['coverimg'], None)
            pixbuf = Pixbuf.new_from_stream(input_stream, None)
            gtkimag = Gtk.Image()
            gtkimag.set_from_pixbuf(pixbuf)

            contenedorenlista = Gtk.Fixed()

            contenedorenlista.put(gtkimag, 20, 0)

            titulo = Gtk.Label()

            titulo_content = Gtk.Label()
            titulo_content.set_text(elem['titulo'])
            titulo_content.set_name("labelama")

            contenedorenlista.put(titulo_content, 0 + corrimientovent, 0)

            temporada = Gtk.Label()
            temporada.set_text("Temporada:")

            temporada_content = Gtk.Label()
            temporada_content.set_text(elem['temporada'] + " " +
                                       str(elem['anio']))
            temporada_content.set_name("labelblue")

            contenedorenlista.put(temporada, 0 + corrimientovent, 20)
            contenedorenlista.put(temporada_content, 85 + corrimientovent, 20)

            progreso = Gtk.Label()
            progreso.set_text("Progreso:")

            progreso_content = Gtk.Label()
            progreso_content.set_text("[" + str(elem['progreso']) + "/" +
                                      str(elem['totepisodios']) + "]")
            progreso_content.set_name("labelverd")

            contenedorenlista.put(progreso, 0 + corrimientovent, 40)
            contenedorenlista.put(progreso_content, 80 + corrimientovent, 40)

            proximo = Gtk.Label()
            proximo.set_text("Episodio")

            proximo_content = Gtk.Label()
            proximo_content.set_text(str(elem['capitulo']))
            proximo_content.set_name("labelros")

            contenedorenlista.put(proximo, 0 + corrimientovent, 60)
            contenedorenlista.put(proximo_content, 65 + corrimientovent, 60)

            largo = len(str(elem['capitulo']))
            corrimiento = 0 + (10 * (largo - 1))
            proximo2 = Gtk.Label()
            proximo2.set_text("sale en")

            proximo_content2 = Gtk.Label()
            proximo_content2.set_text(elem['tiemposalida'])
            proximo_content2.set_name("labelros")

            contenedorenlista.put(proximo2, 80 + corrimiento + corrimientovent,
                                  60)
            contenedorenlista.put(proximo_content2,
                                  135 + corrimiento + corrimientovent, 60)

            self.listbo.add(contenedorenlista)

        self.cargarcss()
        self.window = builder.get_object("window")  #muestro la ventana
        self.window.set_name("ventana")
        self.window.connect("destroy", self.cerrarGTK)
        self.window.show_all()
        self.iniciar()