コード例 #1
0
    def _load_image(self):
        """
            Set the default image
        """
        possible_image = self._path + '/.folder'.replace('//', '/')
        if os.path.exists(possible_image):
            image_path = possible_image
        elif os.path.exists(possible_image + '.png'):
            image_path = possible_image + '.png'
        elif os.path.exists(possible_image + '.jpg'):
            image_path = possible_image + '.jpg'
        elif os.path.exists(possible_image + '.jpeg'):
            image_path = possible_image + '.jpeg'
        else:
            if os.path.exists(self._path):
                image_path = ICON_LOGO_MEDIUM
            else:
                image_path = ICON_ERROR_BIG

        self.pixbuf_small_video = Pixbuf.new_from_file_at_size(
            image_path, self._series_image_small_size,
            self._series_image_small_size)
        self.image_big = Gtk.Image.new_from_pixbuf(
            Pixbuf.new_from_file_at_size(image_path,
                                         self._series_image_big_size + 60,
                                         self._series_image_big_size))
コード例 #2
0
ファイル: g3.py プロジェクト: coxmin/g3-master
 def lock(self, _):
     self.__LOCKED = not self.__LOCKED
     self._ui.LOCK.set_from_pixbuf(
         Pixbuf.new_from_file_at_size(
             'img/lock.png', 24,
             24)) if self.__LOCKED else self._ui.LOCK.set_from_pixbuf(
                 Pixbuf.new_from_file_at_size('img/unlock.png', 24, 24))
コード例 #3
0
def get_pixbuf_for_game(game_slug, icon_type="banner", is_installed=True):
    if icon_type in ("banner", "banner_small"):
        size = BANNER_SIZE if icon_type == "banner" else BANNER_SMALL_SIZE
        default_icon = DEFAULT_BANNER
        icon_path = os.path.join(settings.BANNER_PATH, "%s.jpg" % game_slug)
    elif icon_type == "icon":
        size = ICON_SIZE
        default_icon = DEFAULT_ICON
        icon_path = os.path.join(settings.ICON_PATH,
                                 "lutris_%s.png" % game_slug)

    if not os.path.exists(icon_path):
        icon_path = default_icon
    try:
        pixbuf = Pixbuf.new_from_file_at_size(icon_path, size[0], size[1])
    except GLib.GError:
        pixbuf = Pixbuf.new_from_file_at_size(default_icon, size[0], size[1])
    if not is_installed:
        transparent_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            UNAVAILABLE_GAME_OVERLAY, size[0], size[1])
        transparent_pixbuf = transparent_pixbuf.scale_simple(
            size[0], size[1], GdkPixbuf.InterpType.NEAREST)
        pixbuf.composite(transparent_pixbuf, 0, 0, size[0], size[1], 0, 0, 1,
                         1, GdkPixbuf.InterpType.NEAREST, 100)
        return transparent_pixbuf
    return pixbuf
コード例 #4
0
ファイル: widgets.py プロジェクト: nsteenv/lutris
def get_pixbuf_for_game(game_slug, icon_type="banner", is_installed=True):
    if icon_type in ("banner", "banner_small"):
        size = BANNER_SIZE if icon_type == "banner" else BANNER_SMALL_SIZE
        default_icon = DEFAULT_BANNER
        icon_path = os.path.join(settings.BANNER_PATH,
                                 "%s.jpg" % game_slug)
    elif icon_type == "icon":
        size = ICON_SIZE
        default_icon = DEFAULT_ICON
        icon_path = os.path.join(settings.ICON_PATH,
                                 "lutris_%s.png" % game_slug)

    if not os.path.exists(icon_path):
        icon_path = default_icon
    try:
        pixbuf = Pixbuf.new_from_file_at_size(icon_path, size[0], size[1])
    except GLib.GError:
        pixbuf = Pixbuf.new_from_file_at_size(default_icon, size[0], size[1])
    if not is_installed:
        transparent_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            UNAVAILABLE_GAME_OVERLAY, size[0], size[1]
        )
        transparent_pixbuf = transparent_pixbuf.scale_simple(
            size[0], size[1], GdkPixbuf.InterpType.NEAREST
        )
        pixbuf.composite(transparent_pixbuf, 0, 0, size[0], size[1],
                         0, 0, 1, 1, GdkPixbuf.InterpType.NEAREST, 100)
        return transparent_pixbuf
    return pixbuf
コード例 #5
0
    def __init__(self, session=None, lista_comics_id=None):
        ImageFile.LOAD_TRUNCATED_IMAGES = True
        if session is None:
            self.session = Entidades.Init.Session()
        else:
            self.session = session

        self.handlers = {
            'Guardar': self.Guardar,
            'click_mouse': self.click_mouse,
            'crear_globo': self.crear_globo,
            'actualizar_imagen': self.actualizar_imagen,
            'seleccion_arbol': self.seleccion_arbol,
            'guardar_coordenadas': self.guardar_coordenadas,
            'mover_texto': self.mover_texto,
            'delete_nodo': self.delete_nodo
        }

        self.cataloged_pix = Pixbuf.new_from_file_at_size(
            '../iconos/Cataloged.png', 32, 32)

        self.comicbooks_manager = Comicbooks(session=self.session,
                                             lista_comics_id=lista_comics_id)

        builder = Gtk.Builder()
        builder.add_from_file("../Glade_files/Comicbook_Editor.glade")
        builder.connect_signals(self.handlers)
        self.window = builder.get_object("Comicbook_editor")
        self.imagen_pagina = builder.get_object("imagen_pagina")
        self.spinner_pos_x_0 = builder.get_object("spinner_pos_x_0")
        self.spinner_pos_y_0 = builder.get_object("spinner_pos_y_0")
        self.spinner_pos_x_1 = builder.get_object("spinner_pos_x_1")
        self.spinner_pos_y_1 = builder.get_object("spinner_pos_y_1")
        self.arbol = builder.get_object('arbol')
        self.liststore_arbol = builder.get_object("liststore_arbol")
        self.entry_text = builder.get_object("entry_text")
        self.labels_coords = builder.get_object('labels_coords')

        self.event_box = builder.get_object("event_box")
        self.window.set_title("Editor")
        self.app_icon = Pixbuf.new_from_file_at_size(
            '../iconos/iconoBabelComics-buuf.png', 32, 32)
        self.window.set_icon_from_file('../iconos/iconoBabelComics-buuf.png')
        self.window.set_default_icon_list([self.app_icon])
        self.comicbook = None
        self.last_id_used = 0
        self.diccionario_globos = {}
        self.current_node = 0

        #atributos para capturar y crear los globos de texto
        self.cantidad_clicks = 0
        self.modo = self.CREANDO_GLOBO
        self.lista_clicks = [0, 0, 0, 0]

        if lista_comics_id is not None:
            self.load_page(lista_comics_id[0])
        self.load_json_file()
コード例 #6
0
def show_app(builder,iconview,treepath):

	global stage
	global SubCategoryList
	global ProgramList

	#Is AlreadyOpen Bool
	global ProgramViewOpen
	#Which Subcategory
	global ProgramName


	
	#ShowDialog if not already open
	if ProgramViewOpen != True:
		AppWin = builder.get_object('ApplicationDialog_Install')

		ProgramName = ProgramList[treepath.get_indices()[0]]

		Data = db.read_attributes(ProgramName)

		#Set Name, Short and Long description, Symbol, Screenshot
		Title = builder.get_object('AD_App_Label')
		Title.set_text(Data[1])

		#Short Description
		ShortDescription = builder.get_object('AD_ShortDescription')
		ShortDescription.set_text(Data[2])

		#Long Description
		LongDescription = builder.get_object('AD_LongDescription')
		LongDescription.set_text(Data[3])

		#Symbol
		Symbol = builder.get_object('AD_Symbol')
		try:
			SymbolPixbuf = Pixbuf.new_from_file_at_size(conf.get_entry('DB','dblocation') + Data[8],64 ,64)
			Symbol.set_from_pixbuf(SymbolPixbuf)
		except:
			Symbol.set_from_icon_name('error-dialog',10)
			print('Failed To Load Symbol')

		#Screenshot
		Screenshot = builder.get_object('AD_Screenshot')
		try:
			ScreenshotPixbuf = Pixbuf.new_from_file_at_size(conf.get_entry('DB','dblocation') + Data[4],512 ,512)
			Screenshot.set_from_pixbuf(ScreenshotPixbuf)
		except:
			Screenshot.set_from_icon_name('error-dialog',10)
			print('Failed to load Screenshot')
		
		
		AppWin.show_all()
		ProgramViewOpen = True
	else:
		ErrorWinAppView = builder.get_object('AD_AVIsOpen')
		ErrorWinAppView.show_all()
コード例 #7
0
 def set_image(self, path):
     if os.path.exists(path):
         self.pixbuf_small_video = Pixbuf.new_from_file_at_size(
             path, self._series_image_small_size,
             self._series_image_small_size)
         self.image_big = Gtk.Image.new_from_pixbuf(
             Pixbuf.new_from_file_at_size(path,
                                          self._series_image_big_size + 60,
                                          self._series_image_big_size))
         shutil.copy2(path, self._path + "/.folder")
コード例 #8
0
    def load_image(self):
        sz_food = self.data['block_size'] * 1.2

        self.pix_icon = Pixbuf.new_from_file(self.data['image_icon'])
        self.pix_food = Pixbuf.new_from_file_at_size(
            self.data['image_snake_food'], sz_food, sz_food)
        self.pix_arrow = Pixbuf.new_from_file_at_size(self.data['image_arrow'],
                                                      28, 28)
        self.pix_arrow_key = Pixbuf.new_from_file_at_size(
            self.data['image_arrow_key'], 28, 28)

        self.img_logo.set_from_pixbuf(
            self.pix_icon.scale_simple(24, 24, InterpType.BILINEAR))
コード例 #9
0
 def __init__(self, lottery, **args):
     MyWindow.__init__(self, utils.resolvePath('glade/Lottery.glade'))
     img = Pixbuf.new_from_file_at_size(utils.resolvePath('images/RPG-icon.png'), width=128, height=128)
     self.getWindow().set_icon(img)
     self.getWindow().set_title("Loterie")
     self.lottery = lottery
     self.interval = 0.1
     self.times = 50
     self.handlerItemIdItem = 0
     self.handlerItemIdRand = self.addEvent('button-launch', 'clicked', self.randomise)
     self.catImg = {
         "parchment":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Document.png"),
         "book":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Ebook.png"),
         "stick":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Stick.png"),
         "sword":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/sword.png"),
         "axe":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Axe.png"),
         "att":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/SwordAxe.png"),
         "shoe":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Pegasus-Boot.png"),
         "helmet":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Music-4.png"),
         "shield":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Shield-Security.png"),
         "armor":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Armor.png"),
         "unknown":utils.resolvePath("images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Storage.png")
     }
     self.changeImage("image-give-me-your-money", utils.resolvePath('images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Gold.png'), width=96, height=96)
     self.changeTextLabel("label-name-lottery", "Le loto de Ginette")
     self.changeImage('image-arrow', utils.resolvePath('images/Legendora-Icon-Set-by-Raindropmemory/Legendora-Icon-Set/Icon/Download.png'), width=96, height=96)
     self.threadJobRandom = ThreadJob(self.displayRandom, 0.01, 1)
     self.threadJobRandom.start()
     load(self.getWindow())
コード例 #10
0
 def add_pb(model, path, iter, data):
     try:
         pb = Pixbuf.new_from_file_at_size(
             IMGPATH.format(model[iter][0]), scale, scale)
     except GLib.Error:
         pb = missing
     model.set_value(iter, 8, pb)
コード例 #11
0
ファイル: widgets.py プロジェクト: Cybolic/lutris
def get_pixbuf_for_game(game_slug, size=ICON_SIZE, is_installed=True):
    width = size[0]
    height = size[1]
    icon_path = os.path.join(settings.DATA_DIR, "banners", "%s.jpg" % game_slug)
    if not os.path.exists(icon_path):
        icon_path = MISSING_ICON
    try:
        pixbuf = Pixbuf.new_from_file_at_size(icon_path, width, height)
    except GLib.GError:
        pixbuf = Pixbuf.new_from_file_at_size(MISSING_ICON, width, height)
    if not is_installed:
        transparent_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(UNAVAILABLE_GAME_OVERLAY, width, height)
        transparent_pixbuf = transparent_pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.NEAREST)
        pixbuf.composite(transparent_pixbuf, 0, 0, width, height, 0, 0, 1, 1, GdkPixbuf.InterpType.NEAREST, 100)
        return transparent_pixbuf
    return pixbuf
コード例 #12
0
ファイル: Interface.py プロジェクト: FrLallemand/image-lister
def main():

    builder = Gtk.Builder()
    builder.add_from_file("ui.glade")
    builder.connect_signals(Handler())

    grid = builder.get_object("grid")
    window = builder.get_object("mainWindow")

    liststore = Gtk.ListStore(Pixbuf, str)
    iconview = builder.get_object("iconview")
    iconview.set_model(liststore)
    iconview.set_pixbuf_column(0)
    iconview.set_item_orientation(Gtk.Orientation.VERTICAL)

    for filename in glob.glob(path.expanduser("~/Images/" + "*")):
        if path.isfile(filename):
            pi = Pixbuf.new_from_file_at_size(filename, 150, 150)
            liststore.append([pi, filename])

    print(iconview.get_row_spacing())
    print(iconview.get_column_spacing())
    print(iconview.get_item_padding())
    print(iconview.get_item_width())
    print(iconview.get_margin())
    window.show_all()

    Gtk.main()
コード例 #13
0
ファイル: g3.py プロジェクト: coxmin/g3-master
    def _update_tree_head(self):
        def do_w(x):
            dd = (d1 + x - 1) % 7
            l, ll, e, h = Gtk.Label(str(x)), Gtk.Label(
                'LMMJVSD'[dd]), Gtk.EventBox(), Gtk.VBox(False, 0)
            h.add(l)
            h.add(ll)
            e.add(h)
            e.connect('button-press-event', self.on_day_highlight, x)
            e.get_style_context().add_class('hday')
            self._ui.grid.attach(e, x, 0, 1, 1)
            uz.mcls((l, ll), ('azi', 'aziday')) if x == today else uz.mcls(
                (l, ll), cls[dd])

        self._ui.grid.remove_row(0)
        self._ui.grid.insert_row(0)
        h = Gtk.HBox(False, 0)
        b = uz.imgbt(img=Gtk.Image.new_from_pixbuf(
            Pixbuf.new_from_file_at_size('img/agent.png', 32, 32)),
                     cls='htree',
                     bind=self.set_get_method)
        l = Gtk.Label('Agent')
        l.get_style_context().add_class('htree')
        h.pack_start(b, False, True, 0)
        h.add(l)
        self._ui.grid.attach(h, 0, 0, 1, 1)
        yy, mm = self._seldt.year, self._seldt.month
        d1, today = date(yy, mm, 1).weekday(), self._time.day
        cls = [('day', 'dayday'), ('day', 'dayday'), ('day', 'dayday'),
               ('day', 'dayday'), ('day', 'dayday'), ('samb', 'sambday'),
               ('dumi', 'dumiday')]
        map(do_w,
            xrange(1,
                   monthrange(self._seldt.year, self._seldt.month)[1] + 1))
コード例 #14
0
ファイル: gameviews.py プロジェクト: dacp17/lutris
def get_pixbuf_for_game(game_slug, icon_type, is_installed):
    if icon_type in ("banner", "banner_small"):
        size = BANNER_SIZE if icon_type == "banner" else BANNER_SMALL_SIZE
        default_icon = DEFAULT_BANNER
        icon_path = os.path.join(settings.BANNER_PATH,
                                 "%s.jpg" % game_slug)
    elif icon_type == "icon":
        size = ICON_SIZE
        default_icon = DEFAULT_ICON
        icon_path = os.path.join(settings.ICON_PATH,
                                 "lutris_%s.png" % game_slug)

    if not os.path.exists(icon_path):
        pixbuf = get_default_icon(default_icon, size)
    else:
        try:
            pixbuf = Pixbuf.new_from_file_at_size(icon_path, size[0], size[1])
        except GLib.GError:
            pixbuf = get_default_icon(default_icon, size)
    if not is_installed:
        transparent_pixbuf = get_overlay(size).copy()
        pixbuf.composite(transparent_pixbuf, 0, 0, size[0], size[1],
                         0, 0, 1, 1, GdkPixbuf.InterpType.NEAREST, 100)
        return transparent_pixbuf
    return pixbuf
コード例 #15
0
 def add_pb(model, path, iter, data):
     try:
         pb = Pixbuf.new_from_file_at_size(
             IMGPATH.format(model[iter][3]), size, size)
     except GLib.Error:
         pb = avatar
     model.set_value(iter, 4, pb)
コード例 #16
0
ファイル: gtk.py プロジェクト: vaurelios/pyis-uploader
 def _cb_open(self, button):
     dlg_open = Gtk.FileChooserDialog(
                                      "Open Image",
                                      button.get_toplevel(),
                                      Gtk.FileChooserAction.OPEN,
                                      (
                                         Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                         Gtk.STOCK_OPEN, Gtk.ResponseType.OK
                                      ))
     dlg_open.set_default_response(1)
     dlg_open.set_select_multiple(True)
     
     filef = Gtk.FileFilter()
     filef.add_pixbuf_formats()
     dlg_open.set_filter(filef)
     
     if dlg_open.run() == Gtk.ResponseType.OK:
         for f in dlg_open.get_filenames():
             img = Pixbuf.new_from_file_at_size(f, 128, 128)
             
             name = f.split('/')[-1]
             if len(name) > 18:
                 name = name[:8] + '...' + name[-8:]
             
             self.queue_ls.append([img, name, f])
     dlg_open.destroy()
コード例 #17
0
ファイル: hm_gtk3_bpcv.py プロジェクト: zhujiang73/bpdimgs
    def on_selection_changed(self, selection):  #{ on_selection_changed start
        #print (type(selection))
        self.image_view = Gtk.Image()
        iters = selection.get_selected_items()
        if len(iters) > 0:
            str_idx_sel = iters[0].to_string()
            idx_sel = int(str_idx_sel)
            #print (type(iters[0]),",",type(iters[0].to_string()), " : ", str_idx_sel)
            #print (idx_sel, img_fns[idx_sel])
            self.str_img_fn = self.img_paths[self.imgs_show_idx + idx_sel]
            pixbuf = Pixbuf.new_from_file_at_size(
                self.img_paths[self.imgs_show_idx + idx_sel], self.img_wh,
                self.img_wh)
            self.image_view.set_from_pixbuf(pixbuf)
            self.show_entry.set_text(self.img_paths[idx_sel])

            self.img_width_1x = pixbuf.get_width()
            self.img_height_1x = pixbuf.get_height()

            self.img_width = self.img_width_1x
            self.img_height = self.img_height_1x

            print("img_{0} w_h:{1}x{2} {3}".format(
                idx_sel, self.img_width, self.img_height,
                self.img_paths[self.imgs_show_idx + idx_sel]))

        self.show_win.remove(self.show_view)
        self.show_win.add(self.image_view)
        self.show_win.show_all()
        self.show_view = self.image_view

        strbuf = Gtk.TextBuffer()
        strbuf.set_text("")
        self.show_text_view.set_buffer(strbuf)
        """
コード例 #18
0
ファイル: tagflowbox.py プロジェクト: kiwinaut/tagger
    def add_sggstchild(self, row):
        child = Gtk.FlowBoxChild()
        child.id = row[0]
        child.label = row[1]
        try:
            pb = Pixbuf.new_from_file_at_size(
                f'/media/soni/1001/persistent/1001/thumbs/{row[2]}.jpg', 256,
                256)
        except:
            pb = missing
        child.thumb = pb

        child.set_has_tooltip(True)
        child.connect('query-tooltip', self.on_label_tooltip_queried)
        # child.set_halign(1)
        # child.set_valign(1)

        box = Gtk.Box.new(orientation=0, spacing=0)
        c = box.get_style_context()
        c.add_class('sggst')

        link_event = Gtk.EventBox()
        labelw = Gtk.Label(child.label.title())
        labelw.set_selectable(True)
        link_event.add(labelw)
        link_event.connect('button-release-event', self.on_link_clicked, child)
        box.pack_start(link_event, True, True, 0)

        child.add(box)
        child.show_all()

        self.add(child)
コード例 #19
0
 def add_pb(model, path, iter, data):
     try:
         pb = Pixbuf.new_from_file_at_size(
             IMGPATH.format(model[iter][3]), 192, 192)
     except GLib.Error:
         pb = avatar
     GLib.idle_add(self.set_value, iter, 4, pb)
コード例 #20
0
    def load_store(self):
        missing = self.missing
        scale = self.scale

        if self.query_code == 0:
            sq = Query.get_all_files('archives', self.query_page,
                                     self.query_sort, self.query_order,
                                     self.query_fn_filter)
        elif self.query_code == 1:
            sq = Query.get_1tag_files('archives', self.query_page,
                                      self.query_sort, self.query_order,
                                      self.query_fn_filter)
        elif self.query_code == -1:
            sq = Query.get_notag_files('archives', self.query_page,
                                       self.query_sort, self.query_order,
                                       self.query_fn_filter)
        self.clear()
        for q in sq:
            try:
                pb = Pixbuf.new_from_file_at_size(IMGPATH.format(q[0]), scale,
                                                  scale)
            except GLib.Error:
                pb = missing
            self.append((
                *q[:-1],
                pb,
            ))
コード例 #21
0
ファイル: ui.py プロジェクト: necrose99/Kirmah
 def on_about(self, btn):
     """"""
     about = AboutDialog()
     about.set_program_name(conf.PRG_NAME)
     about.set_version("v " + conf.PRG_VERS)
     about.set_copyright(conf.PRG_ABOUT_COPYRIGHT)
     about.set_comments(conf.PRG_ABOUT_COMMENTS)
     about.set_website(conf.PRG_WEBSITE)
     about.set_website_label(conf.PRG_WEBSITE)
     about.set_license(Io.get_data(conf.PRG_LICENSE_PATH))
     pixbuf = Pixbuf.new_from_file_at_size(conf.PRG_LOGO_PATH, conf.PRG_ABOUT_LOGO_SIZE, conf.PRG_ABOUT_LOGO_SIZE)
     about.set_logo(pixbuf)
     pixbuf = Pixbuf.new_from_file_at_size(conf.PRG_LOGO_PATH, conf.PRG_ABOUT_LOGO_SIZE, conf.PRG_ABOUT_LOGO_SIZE)
     about.set_icon(pixbuf)
     about.run()
     about.destroy()
コード例 #22
0
def go_Sub(builder,iconview,treepath,SelectedMain):
	
	global stage
	global SubCategoryList
	global ProgramList
	global liststore
	
	global SelectedSubCat
	
	SelectedSubCat = SubCategoryList[treepath.get_indices()[0]]
	
	#Clear Icons
	liststore = iconview.get_model()
	liststore.clear()
	
	ProgramList = db.db_read(SelectedSubCat)

	for i in ProgramList:
		pixbuf = Pixbuf.new_from_file_at_size(str(conf.get_entry('DB','dblocation') + db.read_attributes(i)[8]),64,64)
		liststore.append([pixbuf, i])
	iconview.show_all()


	stage = 'Prog'

	feedback.status_push(conf.get_entry("Status","menuprogram"))
コード例 #23
0
    def add_commands(self, commands):

        command_icon = Pixbuf.new_from_file_at_size(
            "{base_path}/res/command.svg".format(base_path=os.path.dirname(os.path.realpath(__file__))), 16, 16
        )

        for name, command in commands.items():
            self.append({"type": "command", "name": name, "keyword": command, "command": command, "icon": command_icon})
コード例 #24
0
ファイル: dirFrame.py プロジェクト: arkocal/filebrowser
def getThumbnail(path, size):
    """Gets thumbnail for file at path. The function will try to create
    one if it is not found. Returns None if this fails."""
    defaultIcon = Gtk.IconTheme.get_default().load_icon("gtk-file", size, 0)
    thumbnailPath = pathToThumbnailPath(path, size)
    thumbnailers = loadThumbnailers()
    pixbuf = None
    try: 
        return Pixbuf.new_from_file_at_size(thumbnailPath, size, size)
    except: 
        pass
    if size>128:
        tsize = 256
    else:
        tsize = 128
    try:    
        pixbuf = Pixbuf.new_from_file_at_size(path, tsize, tsize)
    except:
        pass
    if pixbuf is None and guess_type(path)[0] in thumbnailers.keys():
        o = '"{}"'.format(thumbnailPath)
        u = '"file://{}"'.format(path)
        i = '"{}"'.format(path)
        s = str(tsize)
        command = thumbnailers[guess_type(path)[0]]
        for (pat, sub) in [("%o", o), ("%i", i), ("%u", u), ("%s", s)]:
            command = re.sub(pat, sub, command)       
        os.system(command)
        try:
            pixbuf = Pixbuf.new_from_file_at_size(thumbnailPath, tsize, tsize)
        except:
            return defaultIcon
    if pixbuf is None:
        return defaultIcon
    pixbuf.savev(thumbnailPath, "png", [], [])
    width = pixbuf.get_width()
    height = pixbuf.get_height()
    if height > width:
        width = size * width / height
        height = size
    else:
        height = size * height / width
        width = size
    pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.BILINEAR)
    return pixbuf
コード例 #25
0
 def add_letters(self, ls):
     for i in ls:
         png_file = get_letter_png(self.pt.lang_code, i)
         pixbuf = Pixbuf.new_from_file_at_size(png_file, 70, 70)
         play_sound('add')
         time.sleep(0.1)
         while (Gtk.events_pending()):
             Gtk.main_iteration()
         self.liststore_letters_player.append([pixbuf, repr(i)])
コード例 #26
0
def get_thumbnail_gnome(video_path, list_store, idx):
    file = Gio.File.new_for_path(video_path)
    info = file.query_info("*", 0, None)
    thumbnail = info.get_attribute_byte_string("thumbnail::path")
    if thumbnail is not None:
        new_pixbuf = Pixbuf.new_from_file_at_size(thumbnail, -1, 96)
        list_store[idx][0] = new_pixbuf
    else:
        generate_thumbnail_gnome(video_path)
コード例 #27
0
def get_pixbuf_at_size(filename, size):
    if not os.path.isabs(filename):
        filename = get_pixmap(filename)
    try:
        return Pixbuf.new_from_file_at_size(filename, size, size)
    except GError as ex:
        # Failed to load the pixbuf (Bad image file), so return a blank pixbuf.
        log.warning(ex)
        return create_blank_pixbuf(size)
コード例 #28
0
    def __init__(self, parent, lottery, icons):
        Gtk.Dialog.__init__(
            self,
            "Historique",
            parent,
            0,
            (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
        )

        contentArea = self.get_content_area()
        if len(lottery.history) > 0:
            scrolled = Gtk.ScrolledWindow()
            scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
            scrolled.set_size_request(500, 300)
            vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
            for loot in lottery.history:
                hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
                hbox.set_size_request(300, -1)
                hbox.set_halign(Gtk.Align.START)
                label = Gtk.Label()
                label.set_markup(
                """
<span color="{color}">
Nom : <span weight="bold">{name}</span>
Description : {desc}
Effet : {effect}
Rareté : {rarity}
</span>
                """.format(
                        color = loot['options']['color'],
                        name = loot['item']['nom'],
                        desc = loot['item']['desc'],
                        effect = loot['item']['effet'],
                        rarity = loot['options']['rarity']
                    )
                )
                label.set_halign(Gtk.Justification.LEFT)
                label.set_max_width_chars(100)
                label.set_ellipsize(Pango.EllipsizeMode.END)
                # label.set_size_request(100, -1)
                label.set_line_wrap(True)
                if loot['item']['categorie'] in icons.keys():
                    icon = icons[loot['item']['categorie']]
                else:
                    icon = icons['unknown']
                pixbufImg = Pixbuf.new_from_file_at_size(icon, width=96, height=96)
                img = Gtk.Image()
                img.set_from_pixbuf(pixbufImg)
                hbox.pack_start(img, True, True, 0)
                hbox.pack_start(label, True, True, 0)
                vbox.pack_start(hbox, True, True, 0)
            scrolled.add(vbox)
            contentArea.add(scrolled)
        else:
            contentArea.add(Gtk.Label("Vous n'avez pas encore utilisé la loterie."))
        self.show_all()
コード例 #29
0
 def undo_added(self, cell):
     play_sound('undo')
     letter = self.pt.dict_new[cell]
     if cell in self.pt.cells_empty_letter:
         letter = '*'
         self.pt.cells_empty_letter.remove(cell)
     png_file = get_letter_png(self.pt.lang_code, letter)
     pixbuf = Pixbuf.new_from_file_at_size(png_file, 70, 70)
     self.liststore_letters_player.append([pixbuf, repr(letter)])
     del self.pt.dict_new[cell]
コード例 #30
0
    def satis_ekrani(self):

        self.hasta_tablo()
        self.satis_Table = Gtk.Table(n_rows=10,
                                     n_columns=10,
                                     homogeneous=False)

        satis_patienceLabel = Gtk.Label(label="Patients")
        satis_patientSearch = Gtk.SearchEntry()
        satis_patientSearch.connect("activate", patients_searchBar, self)

        satis_patienceAddButton = Gtk.Button(label="Add")
        satis_patienceAddButton.connect('clicked', hasta_ekle, self)

        self.cart_tablo()
        satis_cartLabel = Gtk.Label(label="Cart")
        satis_cartCleanButton = Gtk.Button(label="Clean")
        satis_cartCleanButton.connect('clicked', self.on_click_clean, 1)

        pb = Pixbuf.new_from_file_at_size('qr-code.png', 30, 30)
        image = Gtk.Image()
        image.set_from_pixbuf(pb)
        satis_cartQRButton = Gtk.Button(label="QR")
        satis_cartQRButton.set_image(image)
        satis_cartQRButton.set_image_position(Gtk.PositionType.TOP)
        satis_cartQRButton.set_always_show_image(True)
        satis_cartQRButton.connect('clicked', QRkodcekme, self)

        self.ilac_tablo()
        satis_medicineSearch = Gtk.SearchEntry()
        satis_medicineSearch.connect("activate", medicines_searchBar, self)

        satis_medicineLabel = Gtk.Label(label="Medicines")

        self.satis_checkoutButton = Gtk.Button(label="Checkout to Proceed")
        self.satis_checkoutButton.connect('clicked', self.proceedScreen)

        self.satis_Table.attach(satis_patienceLabel, 0, 3, 0, 1)
        self.satis_Table.attach(satis_patientSearch, 0, 2.5, 1, 2)
        self.satis_Table.attach(satis_patienceAddButton, 2, 3, 1, 2)
        self.satis_Table.attach(self.scroll_patientTable, 0, 3, 2, 5)

        self.satis_Table.attach(satis_cartLabel, 0, 1, 5, 6)
        self.satis_Table.attach(satis_cartCleanButton, 1, 2, 5, 6)
        self.satis_Table.attach(satis_cartQRButton, 2, 3, 5, 6)
        self.satis_Table.attach(self.scroll_cartTable, 0, 3, 6, 9)

        self.satis_Table.attach(satis_medicineLabel, 3, 10, 0, 1)
        self.satis_Table.attach(satis_medicineSearch, 3, 10, 1, 2)

        self.satis_Table.attach(self.scroll_medicineTable, 3, 10, 2, 10)
        self.satis_Table.attach(self.satis_checkoutButton, 0, 3, 9, 10)

        self.view.show_all()
        self.satis_Table.show_all()
コード例 #31
0
    def __init__(self):
        Gtk.Window.__init__(self,
                            title="Entrar - SysBar",
                            window_position="center",
                            modal=True,
                            icon_name="system-lock-screen")
        self.set_resizable(False)

        # Ativa o tema escolhido.
        self.active_theme()

        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                           spacing=6,
                           margin=60,
                           halign="center",
                           valign="center")
        self.add(self.box)

        self.pix = Pixbuf.new_from_file_at_size("icon/logo.svg", 220, 120)
        self.img1 = Gtk.Image()
        self.img1.set_from_pixbuf(self.pix)
        self.box.pack_start(self.img1, True, True, 0)

        self.label = Gtk.Label(label="Username:"******"alpha")
        # Valor predefinido no campo.
        self.username.set_text(self.select_last_user())
        self.box.pack_start(self.username, True, True, 0)

        self.label = Gtk.Label("PIN:")
        self.box.pack_start(self.label, True, True, 0)

        self.pin = Gtk.Entry(max_length=120,
                             input_purpose="password",
                             visibility=False,
                             activates_default=True)
        # Valor predefinido no campo.
        self.pin.set_text('1234')
        self.pin.connect("activate", self.on_button1_clicked)
        self.box.pack_start(self.pin, True, True, 0)

        self.button = Gtk.Button(label="Entrar",
                                 margin_top=5,
                                 height_request=40)
        self.button.connect("clicked", self.on_button1_clicked)
        self.box.pack_start(self.button, True, True, 0)

        self.spinner = Gtk.Spinner(margin=10)
        self.box.pack_start(self.spinner, True, True, 0)

        self.label = Gtk.Label("© COPYRIGHT 2018 SysBar")
        self.box.pack_start(self.label, True, True, 0)
コード例 #32
0
 def on_about(self, btn):
     """"""
     about = AboutDialog()
     about.set_program_name(conf.PRG_NAME)
     about.set_version('v ' + conf.PRG_VERS)
     about.set_copyright(conf.PRG_ABOUT_COPYRIGHT)
     about.set_comments(conf.PRG_ABOUT_COMMENTS)
     about.set_website(conf.PRG_WEBSITE)
     about.set_website_label(conf.PRG_WEBSITE)
     about.set_license(Io.get_data(conf.PRG_LICENSE_PATH))
     pixbuf = Pixbuf.new_from_file_at_size(conf.PRG_LOGO_PATH,
                                           conf.PRG_ABOUT_LOGO_SIZE,
                                           conf.PRG_ABOUT_LOGO_SIZE)
     about.set_logo(pixbuf)
     pixbuf = Pixbuf.new_from_file_at_size(conf.PRG_LOGO_PATH,
                                           conf.PRG_ABOUT_LOGO_SIZE,
                                           conf.PRG_ABOUT_LOGO_SIZE)
     about.set_icon(pixbuf)
     about.run()
     about.destroy()
コード例 #33
0
ファイル: uz.py プロジェクト: coxmin/g3-master
def imgbt(txt='', img=False, sz=32, cls='', bind=''):
    b = Gtk.Button()
    b.connect('clicked', bind)
    if img:
        h = Gtk.HBox(False, 0)
        h.add(Gtk.Label(txt))
        h.add(img if type(img) is Gtk.Image else Gtk.Image.new_from_pixbuf(Pixbuf.new_from_file_at_size(img, sz, sz)))
        b.add(h)
    else:
        b.add(Gtk.Label(txt))
    b.get_style_context().add_class(cls)
    return b
コード例 #34
0
 def undo_added_all(self, *a):
     if len(self.pt.dict_new) == 0: return
     for cell in self.pt.dict_new.keys():
         letter = self.pt.dict_new[cell]
         if cell in self.pt.cells_empty_letter:
             letter = '*'
             self.pt.cells_empty_letter.remove(cell)
         png_file = get_letter_png(self.pt.lang_code, letter)
         pixbuf = Pixbuf.new_from_file_at_size(png_file, 70, 70)
         self.liststore_letters_player.append([pixbuf, repr(letter)])
         self.pt.chequer.queue_draw()
     self.pt.dict_new.clear()
     play_sound('undo')
コード例 #35
0
 def set_query_from_folder2(self, fol_int):
     self.clear()
     for q in Query.get_tags(folder_id=fol_int):
         try:
             pb = Pixbuf.new_from_file_at_size(IMGPATH.format(q[3]), 192,
                                               192)
         except GLib.Error:
             pb = avatar
         self.append((
             *q[:4],
             pb,
             q[4],
         ))
コード例 #36
0
    def __loadPath__(self, path):
        self.liststore.clear()
        needGenerateMiniature = False
        
        for targetDir in self.__getDirs__(path):
            if targetDir == '..':
                pixbuf = Pixbuf.new_from_file_at_size(self.configuration.getTheme().getBackIcon(), self.configuration.getFolderIconSize(), self.configuration.getFolderIconSize())
                backPath = path[0:path.rindex('/')]
                self.liststore.append([pixbuf, '', backPath, True])
            else:
                pixbuf = Pixbuf.new_from_file_at_size(self.configuration.getTheme().getFolderIcon(), self.configuration.getFolderIconSize(), self.configuration.getFolderIconSize())
                self.liststore.append([pixbuf, targetDir, join(path, targetDir), True])

        for targetFile in self.__getFiles__(path):
            miniature = self.__getMiniature__(path, targetFile)
            if (miniature != None):
                try:
                    pixbuf = Pixbuf.new_from_file_at_size(miniature, self.configuration.getFileIconSize(), self.configuration.getFileIconSize())
                except GLib.GError:
                    pixbuf = Pixbuf.new_from_file_at_size(self.configuration.getTheme().getVideoIcon(), self.configuration.getFolderIconSize(), self.configuration.getFolderIconSize())
            else:
                pixbuf = Pixbuf.new_from_file_at_size(self.configuration.getTheme().getVideoIcon(), self.configuration.getFolderIconSize(), self.configuration.getFolderIconSize())
                needGenerateMiniature = True

            self.liststore.append([pixbuf, targetFile, join(path, targetFile), False])

        self.currentPath = path;

        if self.selectedItem != None:
            self.configuration.getLogger().debug('Reset selected item to ' + unicode(self.selectedItem))
            self.catalogView.select_path(self.selectedItem)
            self.catalogView.set_cursor(self.selectedItem, None, False)
            
        if (needGenerateMiniature == True):
            subprocess.Popen(['python', self.configuration.getAppStartDir() + 'worker/miniaturegenerator.py',
                              '-i', self.currentPath, 
                              '-o', self.configuration.getMiniatureDir(), 
                              '-e', self.configuration.getEncoding()])
コード例 #37
0
    def search_product(self, widget):
        code = widget.get_text()
        if len(code) == 4:
            self.preProduct = None
            result = SbProducts(code)
            data = result.search_product()
            if data['rStatus'] == 1:
                self.preProduct = data['data'][0]
                name = self.limit_string(data['data'][2]).upper()

                imgName = "static/{}".format(data['data'][3])
                pix = Pixbuf.new_from_file_at_size(imgName, 320, 220)
                self.img.set_from_pixbuf(pix)

                self.lName.set_markup(
                    "<span size='20000' color='red'>{}</span>".format(name))
                self.lPrice.set_markup(
                    "<span size='12000'>VALOR UNITÁRIO: </span><span size='18000' color='blue'>R${}</span>"
                    .format(str(data['data'][4]).replace(".", ',')))
                widget.set_text("")
        elif len(code) >= 10:
            self.preProduct = None
            result = SbProducts()
            data = result.search_product(code)
            if data['rStatus'] == 1:
                self.preProduct = data['data'][0]
                name = self.limit_string(data['data'][2]).upper()

                imgName = "static/{}".format(data['data'][3])
                pix = Pixbuf.new_from_file_at_size(imgName, 320, 220)
                self.img.set_from_pixbuf(pix)

                self.lName.set_markup(
                    "<span size='20000' color='red'>{}</span>".format(name))
                self.lPrice.set_markup(
                    "<span size='12000'>VALOR UNITÁRIO: </span><span size='18000' color='blue'>R${}</span>"
                    .format(str(data['data'][4]).replace(".", ",")))
                widget.set_text("")
コード例 #38
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
コード例 #39
0
 def about_dialog(self, widget):
     about = Gtk.AboutDialog()
     about.set_transient_for(Gtk.Window())
     pix = Pixbuf.new_from_file_at_size("icon/logo.svg", 260, 140)
     about.set_logo(pix)
     about.set_program_name("SysBar")
     about.set_version("0.1")
     about.set_website("https://www.sysbar.com.br/")
     about.set_website_label("SysBar Delivery")
     about.set_comments("Sistema de gerenciamento de bares e lanchonetes.")
     about.set_authors(["Gabriel Lasaro", "Samuel Tessaro"])
     about.set_copyright("© COPYRIGHT 2018 SysBar")
     about.run()
     about.destroy()
コード例 #40
0
def get_thumbnail(video_path, list_store, idx):
    # TODO too resource intensive, looking for a better approach
    root_path = os.path.dirname(video_path) + '/.thumbnails'
    file_path = '{}/{}.png'.format(root_path, os.path.basename(video_path))
    if not os.path.exists(file_path):
        create_dir(root_path)
        sec = get_length(video_path) / 3
        subprocess.call(
            'ffmpeg -y -i "{}" -ss {}.000 -vf scale=96:-1 -vframes 1 "{}" -loglevel quiet > /dev/null 2>&1 < /dev/null'
            .format(video_path, time.strftime('%H:%M:%S', time.gmtime(sec)),
                    file_path),
            shell=True)
    new_pixbuf = Pixbuf.new_from_file_at_size(file_path, -1, 96)
    list_store[idx][0] = new_pixbuf
コード例 #41
0
    def add_launchers(self):

        command_icon = Pixbuf.new_from_file_at_size(
            "{base_path}/res/command.svg".format(base_path=os.path.dirname(os.path.realpath(__file__))), 16, 16
        )

        theme = IconTheme()

        for launcher_directory in ["/home/wouter/.local/share/applications", "/usr/share/applications"]:

            for launcher in os.listdir(launcher_directory):

                try:
                    config = ConfigParser.ConfigParser()
                    config.read("%s/%s" % (launcher_directory, launcher))

                    if not config.has_section("Desktop Entry"):
                        continue

                    if not config.get("Desktop Entry", "type") == "Application":
                        continue

                    icon_name = config.get("Desktop Entry", "icon")

                    icon = command_icon

                    if icon_name != "eclipse.png":
                        print icon_name
                        try:
                            icon = theme.load_icon(icon_name, 20, 0)
                        except:
                            pass

                    self.append(
                        {
                            "type": "command",
                            "name": config.get("Desktop Entry", "name"),
                            "keyword": "",
                            "command": config.get("Desktop Entry", "exec"),
                            "icon": icon,
                        }
                    )

                except ConfigParser.Error:
                    pass
コード例 #42
0
ファイル: actions.py プロジェクト: idnael/ctxsearch
    def _action_to_menuitem(self, ctx, action):
        menuitem = Gtk.ImageMenuItem(action["title"])

        # the icon could have been read from the config, or set in one of the modules
        if "icon" in action: # and os.path.exists(action["icon"]):

            # nota: pode ser absoluto já e nesse caso o cfgdir é ignorado
            iconfile = os.path.join(self.cfg.cfgdir, "icons", action["icon"])

            if os.path.exists(iconfile):
                pixbuf = Pixbuf.new_from_file_at_size(iconfile, self.MENU_ICON_SIZE, self.MENU_ICON_SIZE)
                img = Gtk.Image()
                img.set_from_pixbuf(pixbuf)

                menuitem.set_image(img)

                # if I don't call this, the image will only appear if gnome is configured to show images in menus!
                # But I reallly want the images!!!
                menuitem.set_always_show_image(True)

        menuitem.connect('activate', self.on_menu_action, ctx, action)
        return menuitem
コード例 #43
0
ファイル: png2pdf.py プロジェクト: rodolfovick/png2pdf
    def addFile(self, widget):
        """
        Add file (image) dialog.
        """
        dialog = Gtk.FileChooserDialog(
            "Please choose a file",
            self,
            Gtk.FileChooserAction.OPEN,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK),
        )

        # self.add_filters(dialog)

        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            fileName = dialog.get_filename()
            self.fileList.append(fileName)
            pixBuf = Pixbuf.new_from_file_at_size(fileName, 120, 120)
            self.listStore.append([pixBuf])
        elif response == Gtk.ResponseType.CANCEL:
            print("Cancel clicked")

        dialog.destroy()
コード例 #44
0
ファイル: mintwelcome.py プロジェクト: JosephMcc/mintwelcome
    def __init__(self):
        window = Gtk.Window()
        window.set_title(_("Welcome Screen"))
        window.set_icon_from_file("/usr/share/linuxmint/logo.png")
        window.set_position(Gtk.WindowPosition.CENTER)
        window.connect("destroy", Gtk.main_quit)

        with open("/etc/linuxmint/info") as f:
            config = dict([line.strip().split("=") for line in f])

        codename = config['CODENAME'].capitalize()
        edition = config['EDITION']
        release = config['RELEASE']
        desktop = config['DESKTOP']
        self.release_notes = config['RELEASE_NOTES_URL']
        self.user_guide = "http://www.linuxmint.com/documentation.php"  # Switch to config['USER_GUIDE_URL'] when mintdoc is ready and localized
        self.new_features = config['NEW_FEATURES_URL']

        # distro-specific
        self.is_lmde = False
        self.dist_name = "Linux Mint"
        self.codec_pkg_name = "mint-meta-codecs"

        if os.path.exists("/usr/share/doc/debian-system-adjustments/copyright"):
            self.is_lmde = True
            self.dist_name = "LMDE"
            self.codec_pkg_name = "mint-meta-debian-codecs"
        else:
            if "KDE" in desktop:
                self.codec_pkg_name = "mint-meta-codecs-kde"

        current_theme = Gtk.Settings.get_default().get_property("gtk-theme-name")

        if(current_theme.startswith("Mint-X")):
            mint_x_theme = True
            mint_x_theme_html = " fgcolor='#3e3e3e'"
        else:
            mint_x_theme = False
            mint_x_theme_html = ""

        bgcolor = Gdk.RGBA()
        bgcolor.parse("rgba(0,0,0,0)")

        fgcolor = Gdk.RGBA()
        fgcolor.parse("#3e3e3e")

        main_box = Gtk.VBox()

        event_box = Gtk.EventBox()
        event_box.set_name("event_box")
        event_box.override_background_color(Gtk.StateType.NORMAL, bgcolor)
        main_box.pack_start(event_box, True, True, 0)

        vbox = Gtk.VBox()
        vbox.set_border_width(12)
        vbox.set_spacing(0)
        event_box.add(vbox)

        headerbox = Gtk.VBox()
        logo = Gtk.Image()
        logo.set_from_icon_name("mintwelcome", Gtk.IconSize.DIALOG)

        headerbox.pack_start(logo, False, False, 0)
        label = Gtk.Label()

        label.set_markup("<span font='12.5'" + mint_x_theme_html + ">%s %s '<span fgcolor='#709937'>%s</span>'</span>" % (self.dist_name, release, codename))

        headerbox.pack_start(label, False, False, 0)
        label = Gtk.Label()
        label.set_markup("<span font='8'" + mint_x_theme_html + "><i>%s</i></span>" % edition)
        headerbox.pack_start(label, False, False, 2)
        vbox.pack_start(headerbox, False, False, 10)

        welcome_label = Gtk.Label()
        welcome_message = _("Welcome and thank you for choosing Linux Mint. We hope you'll enjoy using it as much as we did designing it. The links below will help you get started with your new operating system. Have a great time and don't hesitate to send us your feedback.")
        welcome_label.set_markup("<span font='9'" + mint_x_theme_html + ">%s</span>" % welcome_message)

        welcome_label.set_line_wrap(True)
        vbox.pack_start(welcome_label, False, False, 10)

        separator = Gtk.Image()
        separator.set_from_file('/usr/share/linuxmint/mintwelcome/icons/separator.png')
        vbox.pack_start(separator, False, False, 10)

        liststore = Gtk.ListStore(Pixbuf, str, str, str, Pixbuf, Pixbuf)
        self.iconview = Gtk.IconView.new()
        self.iconview.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
        self.iconview.connect("item-activated", self.item_activated)
        self.iconview.connect("motion-notify-event", self.on_pointer_motion)
        self.iconview.connect("button-press-event", self.on_mouse_click)
        self.iconview.set_model(liststore)
        self.iconview.set_pixbuf_column(0)
        self.iconview.set_text_column(2)
        self.iconview.set_tooltip_column(3)
        self.iconview.set_columns(4)
        self.iconview.set_margin(0)
        self.iconview.set_spacing(6)
        self.iconview.set_item_padding(3)
        self.iconview.set_row_spacing(20)
        self.iconview.set_column_spacing(20)
        self.iconview.override_background_color(Gtk.StateType.NORMAL, bgcolor)
        if(mint_x_theme):
            self.iconview.override_color(Gtk.StateType.NORMAL, fgcolor)
        #self.iconview.connect("selection-changed", self.item_activated)
        hbox = Gtk.HBox()
        hbox.pack_start(self.iconview, True, True, 30)
        vbox.pack_start(hbox, False, False, 10)

        actions = []

        add_codecs = False

        import apt
        cache = apt.Cache()
        if self.codec_pkg_name in cache:
            pkg = cache[self.codec_pkg_name]
            if not pkg.is_installed:
                add_codecs = True

        self.last_selected_path = None

        if add_codecs:
            if self.is_lmde:
                actions.append(['new_features', _("New features"), _("See what is new in this release")])

            actions.append(['user_guide', _("Documentation"), _("Learn all the basics to get started with Linux Mint")])
            actions.append(['software', _("Apps"), _("Install additional software")])

            if not self.is_lmde:
                actions.append(['driver', _("Drivers"), _("Install hardware drivers")])

            actions.append(['codecs', _("Multimedia codecs"), _("Add all the missing multimedia codecs")])
            actions.append(['forums', _("Forums"), _("Seek help from other users in the Linux Mint forums")])
            actions.append(['chatroom', _("Chat room"), _("Chat live with other users in the chat room")])
            actions.append(['get_involved', _("Getting involved"), _("Find out how to get involved in the Linux Mint project")])
            actions.append(['donors', _("Donations"), _("Make a donation to the Linux Mint project")])
        else:
            actions.append(['new_features', _("New features"), _("See what is new in this release")])

            if self.is_lmde:
                actions.append(['release_notes', _("Release notes"), _("Read the release notes")])

            actions.append(['user_guide', _("Documentation"), _("Learn all the basics to get started with Linux Mint")])
            actions.append(['software', _("Apps"), _("Install additional software")])

            if not self.is_lmde:
                actions.append(['driver', _("Drivers"), _("Install hardware drivers")])

            actions.append(['forums', _("Forums"), _("Seek help from other users in the Linux Mint forums")])
            actions.append(['chatroom', _("Chat room"), _("Chat live with other users in the chat room")])
            actions.append(['get_involved', _("Getting involved"), _("Find out how to get involved in the Linux Mint project")])
            actions.append(['donors', _("Donations"), _("Make a donation to the Linux Mint project")])

        for action in actions:
            desat_pixbuf = Pixbuf.new_from_file_at_size('/usr/share/linuxmint/mintwelcome/icons/desat/%s.svg' % action[0], ICON_SIZE, ICON_SIZE)
            color_pixbuf = Pixbuf.new_from_file_at_size('/usr/share/linuxmint/mintwelcome/icons/color/%s.svg' % action[0], ICON_SIZE, ICON_SIZE)
            pixbuf = desat_pixbuf
            liststore.append([pixbuf, action[0], action[1], action[2], desat_pixbuf, color_pixbuf])

        hbox = Gtk.HBox()
        hbox.set_border_width(6)
        main_box.pack_end(hbox, False, False, 0)
        checkbox = Gtk.CheckButton()
        checkbox.set_label(_("Show this dialog at startup"))

        if not os.path.exists(NORUN_FLAG):
            checkbox.set_active(True)

        checkbox.connect("toggled", self.on_button_toggled)
        hbox.pack_end(checkbox, False, False, 2)

        window.add(main_box)
        window.set_default_size(540, 420)

        css_provider = Gtk.CssProvider()

        if(mint_x_theme):
            css = """
            #event_box {
                background-image: -gtk-gradient (linear, left top, left bottom,
                from (#d6d6d6),
                color-stop (0.5, #efefef),
                to (#d6d6d6));
            }
            """
        else:
            css = """
            #event_box {
                background-color: @bg_color;
            }
            """

        css_provider.load_from_data(css.encode('UTF-8'))
        screen = Gdk.Screen.get_default()
        style_context = window.get_style_context()
        style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

        window.show_all()
コード例 #45
0
ファイル: streamerino.py プロジェクト: biberino/streamerino
    def createSubsites(self):
        for i in range (0,self.num_tabs):
            scrolled_window = Gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
            scrolled_window.set_policy(Gtk.PolicyType.ALWAYS,
                    Gtk.PolicyType.ALWAYS)
            vbox = Gtk.VBox(False,25)
            vboxCap = Gtk.VBox(False,25)
            scrolled_window.add_with_viewport(vbox)
            self.captions.append(Gtk.Label("No data loaded. Click refresh to load stream data"))
            self.captions[i].set_use_markup(True)

            vboxCap.pack_start(self.captions[i],False,False,0)
            fixedContainer = Gtk.Fixed()
            
            pb = Pix.new_from_file_at_size('refresh.png', 20,20)
            refIm = Gtk.Image()
            refIm.set_from_pixbuf(pb)

            refButton = Gtk.Button(label="refresh streams", image=refIm)
            refButton.set_size_request(10,10)
            #connect button
            refButton.connect("clicked",self.on_refresh_streams_click)
            #set button color
            self.modifyColor(refButton,self.hover_color,Gtk.StateFlags.PRELIGHT)

            fixedContainer.put(refButton,10,0)

            vboxCap.pack_start(fixedContainer,False,False,0)

            vbox.pack_start(vboxCap,False,False,0)
            for s in range(0,self.num_streams):

                #test fixed container
                #fixed = Gtk.Fixed()
                vboxStatus = Gtk.VBox(False,20)
                vboxStatus.set_border_width(5)
                self.status_labels[i][s] = Gtk.Label("no data")
                self.status_labels[i][s].set_use_markup(True)
                self.status_labels[i][s].set_alignment(0,0)
                vboxStatus.pack_start(self.status_labels[i][s],False,False,0)
                hbox = Gtk.HBox(False,20)
                self.content_labels[i][s] = Gtk.Label("no data")
                self.content_labels[i][s].set_use_markup(True)

                #added eventbox 
                eventbox = Gtk.EventBox()
                eventbox.connect('button-press-event',self.startStream,s)
                eventbox.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
                eventbox.connect("motion-notify-event",self.mouse_over_pic,s)
                eventbox.connect("realize",self.set_cursor)
                
                #self.gameTabs.add_events(Gdk.EventMask.SCROLL_MASK
                #self.modifyWidgetStateBehaviour(eventbox,self.active_color,Gtk.StateType.PRELIGHT)
                
                self.content_pics[i][s] = Gtk.Image()
                eventbox.add(self.content_pics[i][s])


                #button = Gtk.Button("watch")
                #button.connect("clicked",self.startStream, s)
                #self.modifyColor(button,self.hover_color,Gtk.StateFlags.PRELIGHT)

                #button.set_size_request(10,2)
                #fixed.put(button,10,25)


                #hbox.pack_start(fixed,False,False,0)
                hbox.pack_start(eventbox,False,False,30)
                #hbox.pack_start(self.content_pics[i][s],False,False,0)
                hbox.pack_start(self.content_labels[i][s],False,False,0)
                vboxStatus.pack_start(hbox,False,False,0)
                vbox.pack_start(vboxStatus,False,False,25)


            #test
            self.containers.append(scrolled_window)
コード例 #46
0
ファイル: daw_preference.py プロジェクト: RaaH/dawawin
 def build(self,*a):
     Gtk.Dialog.__init__(self, parent=self.parent)
     self.set_icon_name("Dawawin")
     self.set_title("التفضيلات")
     self.resize(500, 300)
     area = self.get_content_area()
     area.set_spacing(6)
     self.connect('delete-event', lambda w,*a: w.hide() or True)
     self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     lab_info = Gtk.Label('بعض الخيارات قد تحتاج إلى إعادة تشغيل البرنامج')
     lab_info.override_background_color(Gtk.StateFlags.NORMAL, daw_customs.rgba('#FFF14E'))
     lab_info.override_color(Gtk.StateFlags.NORMAL, daw_customs.rgba('#E90003'))
     lab_info.override_font(Pango.FontDescription("8"))
     
     self.notebook = Gtk.Notebook()
     self.box0 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     self.box00 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     self.box1 = Gtk.Box(spacing=4, orientation=Gtk.Orientation.VERTICAL)
     self.box2 = Gtk.Box(spacing=4,orientation=Gtk.Orientation.VERTICAL)
     hbox = Gtk.Box(spacing=40,orientation=Gtk.Orientation.HORIZONTAL)
     hbox.pack_start(self.box1, False, False, 0)
     hbox.pack_start(self.box2, False, False, 0)
     self.frame = Gtk.Frame()
     self.frame.add(hbox)
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.dfo = Gtk.RadioButton.new_with_label_from_widget(None, 'افتراضي')
     self.cos = Gtk.RadioButton.new_with_label_from_widget(self.dfo,'مخصص')
     self.dfo.connect('toggled',self.specified,'0')
     self.cos.connect('toggled',self.specified,'1')
     hbox.pack_start(self.dfo, False, False, 0)
     hbox.pack_start(self.cos, False, False, 0)
     self.sel_theme = Gtk.CheckButton('تلوين النافذة')
     hbox.pack_end(self.sel_theme, False, False, 0)
     if daw_config.getv('theme') == '1': self.sel_theme.set_active(True)
     else: self.sel_theme.set_active(False)
     self.sel_theme.connect("toggled", self.has_mytheme)
     hbox.set_border_width(5)
     self.box0.pack_start(hbox, False, False, 0)
     self.box0.pack_start(self.frame, True, True, 0)
    
     list_w1 = [[u'القوائم الجانبية','td'], [u'قائمة القصائد','tp'], [u'متن القصيدة','mp'], 
                [u'الشرح والترجمة','ch'], [u'العناوين','an']]
     list_w2 = [[u'لون خلفية العرض','b'], [u'لون خط التحديد','fs'], [u'لون خلفية التحديد','bs'], 
                [u'لون تحديد البحث','ss'], [u'لون خلفية خاص','bp']]
     for a in list_w1:
         hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
         btn1 = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_FONT)
         btn1.set_name('font'+a[1])
         btn1.connect('clicked',self.ch_font)
         btn2 = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_COLOR)
         btn2.set_name('color'+a[1])
         btn2.connect('clicked',self.ch_color)
         hbox.pack_start(btn2, False, False, 0)
         hbox.pack_start(btn1, False, False, 0)
         hbox.pack_start(Gtk.Label(a[0]), False, False, 0)
         self.box1.pack_start(hbox, False, False, 0)
         
     for a in list_w2:
         hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
         btn = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_COLOR)
         btn.set_name('color'+a[1])
         btn.connect('clicked',self.ch_color)
         hbox.pack_start(btn, False, False, 0)
         hbox.pack_start(Gtk.Label(a[0]), False, False, 0)
         self.box2.pack_start(hbox, False, False, 0)
     self.notebook.append_page(self.box0, Gtk.Label('خط ولون'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     ls = [[0, u'ضيق'],
         [1, u'وسط'],
         [2, u'واسع']]
     hb, self.bayn_abiat = daw_customs.combo(ls, u'المسافة بين الأبيات', 3)
     self.bayn_abiat.set_active(daw_config.getn('b_abiat'))
     self.bayn_abiat.connect('changed', self.change_vls, u'b_abiat')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'ضيق'],
         [1, u'وسط'],
         [2, u'واسع']]
     hb, self.bayn_shater = daw_customs.combo(ls, u'المسافة بين شطري البيت', 3)
     self.bayn_shater.set_active(daw_config.getn('b_half'))
     self.bayn_shater.connect('changed', self.change_vls, u'b_half')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'دوما'],
         [1, u'للحاجة']]
     hb, self.tarakeb = daw_customs.combo(ls, u'تراكب شطري البيت', 3)
     self.tarakeb.set_active(daw_config.getn('tarakeb'))
     self.tarakeb.connect('changed', self.change_vls, u'tarakeb')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'بالتطويلات'],
         [1, u'بالمسافات']]
     hb, self.tandhid = daw_customs.combo(ls, u'تعديل طول الشطر', 3)
     self.tandhid.set_active(daw_config.getn('tandhid'))
     self.tandhid.connect('changed', self.change_vls, u'tandhid')
     vb.pack_start(hb, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     lab = Gtk.Label('أدنى طول للشطر بالبكسلات')
     lab.set_alignment(0,0.5)
     hbox.pack_start(lab, False, False, 0)
     adj = Gtk.Adjustment(150, 100, 700, 1, 5, 0)
     self.min_long = Gtk.SpinButton()
     self.min_long.set_adjustment(adj)
     self.min_long.set_wrap(True)
     self.min_long.set_value(daw_config.getf('min_long'))
     def change_min(widget, *a):
         v = self.min_long.get_value()
         daw_config.setv('min_long', v)
     self.min_long.connect('value-changed', change_min)
     hbox.pack_start(self.min_long, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     lab = Gtk.Label('التراكب إذا تجاوز طول الشطر')
     lab.set_alignment(0,0.5)
     hbox.pack_start(lab, False, False, 0)
     adj = Gtk.Adjustment(350, 300, 1000, 1, 5, 0)
     self.max_long = Gtk.SpinButton()
     self.max_long.set_adjustment(adj)
     self.max_long.set_wrap(True)
     self.max_long.set_value(daw_config.getf('max_long'))
     def change_max(widget, *a):
         v = self.max_long.get_value()
         daw_config.setv('max_long', v)
     self.max_long.connect('value-changed', change_max)
     hbox.pack_start(self.max_long, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('تخطيط'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.del_all = daw_customs.ButtonClass('مسح عام')
     self.del_all.connect('clicked', self.del_all_cb)
     hbox.pack_start(self.del_all, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.add_db = daw_customs.ButtonClass('أنشاء قاعدة بيانات جديدة')
     self.add_db.connect('clicked', self.new_db)
     hbox.pack_start(self.add_db, False, False, 0)
     if not exists(dirname(daw_config.getv('path'))): self.add_db.set_sensitive(False)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     self.e_dest = Gtk.Entry()
     self.e_dest.set_text(daw_config.getv('path').decode('utf8'))
     self.b_dest = daw_customs.ButtonClass('تغيير المسار')
     self.b_dest.connect('clicked', self.change_path_db)  
     hbox.pack_start(self.b_dest, False, False, 0)
     hbox.pack_start(self.e_dest, True, True, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     db_void = Gtk.LinkButton.new_with_label("http://sourceforge.net/projects/dawawin/files/",
                                             'صفحة البرنامج على النت')
     hbox.pack_start(db_void, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('خيارات'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     self.n_dawawin = Gtk.Label('عدد الدواوين : '+daw_config.getv('n_dawawin'))
     self.n_dawawin.set_alignment(0,0.5)
     vb.pack_start(self.n_dawawin, False, False, 0)
     self.n_poems = Gtk.Label('عدد القصائد : '+daw_config.getv('n_poems'))
     self.n_poems.set_alignment(0,0.5)
     vb.pack_start(self.n_poems, False, False, 0)
     self.n_verses = Gtk.Label('عدد الأبيات : '+daw_config.getv('n_verses'))
     self.n_verses.set_alignment(0,0.5)
     vb.pack_start(self.n_verses, False, False, 0)
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     self.rapid_count = daw_customs.ButtonClass('إحصاء سريع')
     self.rapid_count.connect('clicked', self.count_cb)
     self.detail_count = daw_customs.ButtonClass('إحصاء مفصل')
     self.detail_count.connect('clicked', self.show_count)
     self.web_count = daw_customs.ButtonClass('صفحة ويب')
     self.web_count.connect('clicked', lambda *a: self.parent.countpage.make_html())
     hbox.pack_start(self.rapid_count, False, False, 0)
     hbox.pack_start(self.detail_count, False, False, 0)
     hbox.pack_start(self.web_count, False, False, 0)
     vb.pack_end(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('إحصاء'))
     
     vbox = Gtk.Box(spacing=4, orientation=Gtk.Orientation.VERTICAL)
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.sel_ornament = Gtk.CheckButton('اعتمد زخرفة الخلفية')
     hbox.pack_start(self.sel_ornament, False, False, 0)
     if daw_config.getv('ornament') == '1': self.sel_ornament.set_active(True)
     else: self.sel_ornament.set_active(False)
     self.sel_ornament.connect("toggled", self.has_ornament)
     vbox.pack_start(hbox, False, False, 0)
     
     liststore = Gtk.ListStore(Pixbuf, str)
     iconview = Gtk.IconView.new()
     iconview.set_model(liststore)
     iconview.set_pixbuf_column(0)
     iconview.set_reorderable(True)
     list_icons = os.listdir(daw_customs.ORNAMENT)
     iconview.set_columns(6)
     iconview.connect('item-activated', self.sel_ORNAMENT)
     for a in list_icons:
         try:
             pixbuf = Pixbuf.new_from_file_at_size(join(daw_customs.ORNAMENT, a), 64, 64 )
             liststore.append([pixbuf, a])
         except: pass
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(iconview)
     scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
     vbox.pack_start(scroll, True, True, 0)
     self.notebook.append_page(vbox, Gtk.Label('الزخرفة'))
     
     self.box.pack_start(self.notebook, True, True, 0)
     self.box.pack_start(lab_info, False, False, 0)
     
     clo = daw_customs.ButtonClass("إغلاق")
     clo.connect('clicked',lambda *a: self.hide())
     ref = daw_customs.ButtonClass("تحديث الواجهة")
     ref.connect('clicked',lambda *a: self.parent.theme.refrech())
     ref.connect('clicked',lambda *a: self.parent.refrech())
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     hbox.set_border_width(5)
     hbox.pack_start(ref, False, False, 0)
     hbox.pack_end(clo, False, False, 0)
     self.box.pack_start(hbox, False, False, 0)
     if daw_config.getv('tr') == '1':
         self.cos.set_active(True)
     else:
         self.frame.set_sensitive(False)
         self.dfo.set_active(True)
     area.pack_start(self.box, True, True, 0)
コード例 #47
0
ファイル: main_window.py プロジェクト: windwarrior/minimalism
 def populate_with_data(self):
     for floc in glob.glob(os.path.join(self.data_dir, "tiles", "*.json")):
         f = json.load(open(floc))
         td = TileData(f["solid"], f["visible"], f["name"], f["icon"])
         pb = Pixbuf.new_from_file_at_size(os.path.join(self.data_dir, "icons", f["icon"]), 64, 64)
         self.tilestore.append([pb, td])
コード例 #48
0
ファイル: card.py プロジェクト: sugarlabs/pukllanapac
def load_image(file, w, h):
    """ Convert from file to pixbuf at size w, h """
    return Pixbuf.new_from_file_at_size(file, int(w), int(h))
コード例 #49
0
 def resize_and_set_image(self, imageWidget, image_local_path, width = 600, height = 450):
     gtkImage = self.builder.get_object(imageWidget)
     pixbuf = Pixbuf.new_from_file_at_size(image_local_path, width, height)
     gtkImage.set_from_pixbuf(pixbuf)
     gtkImage.show()
コード例 #50
0
ファイル: gameviews.py プロジェクト: dacp17/lutris
def get_default_icon(icon, size):
    x, y = size
    return Pixbuf.new_from_file_at_size(icon, x, y)