• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python IconLoader.load_icon函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pychess.Utils.IconLoader.load_icon函数的典型用法代码示例。如果您正苦于以下问题:Python load_icon函数的具体用法?Python load_icon怎么用?Python load_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_icon函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: getIconByRating

 def getIconByRating (cls, rating, size=16):
     assert isinstance(rating, int), "rating not an int: %s" % str(rating)        
     if rating >= 1900:
         return load_icon(size, "weather-storm")
     elif rating >= 1600:
         return load_icon(size, "weather-showers")
     elif rating >= 1300:
         return load_icon(size, "weather-overcast")
     elif rating >= 1000:
         return load_icon(size, "weather-few-clouds")
     else:
         return load_icon(size, "weather-clear")
开发者ID:sally0813,项目名称:pychess,代码行数:12,代码来源:FICSObjects.py


示例2: getIcon

 def getIcon (self, size=16, gametype=None):
     assert isinstance(size, int), "size not an int: %s" % str(size)
     if self.isGuest():
         return load_icon(size, "stock_people", "system-users")
     elif self.isComputer():
         return load_icon(size, "computer", "stock_notebook")
     elif self.isAdmin():
         return load_icon(size, "security-high", "stock_book_blue")
     else:
         if gametype:
             rating = self.getRatingByGameType(gametype)
         else:
             rating = self.getStrength()
         return self.getIconByRating(rating, size)
开发者ID:sally0813,项目名称:pychess,代码行数:14,代码来源:FICSObjects.py


示例3: addItem

    def addItem(self, text, stock=None):
        if stock is None:
            item = Gtk.MenuItem(text)
        else:
            item = Gtk.ImageMenuItem()
            item.set_name(text)
            label = Gtk.Label(label=text)
            label.props.xalign = 0
            if isinstance(stock, str):
                stock = load_icon(12, stock)
            image = Gtk.Image()
            image.set_from_pixbuf(stock)
            hbox = Gtk.HBox()
            hbox.set_spacing(6)
            hbox.pack_start(image, False, False, 0)
            hbox.add(label)
            item.add(hbox)
            hbox.show_all()

        item.connect("activate", self.menu_item_activate, len(self._items))
        self.menu.append(item)
        self._items += [(text, stock)]
        item.show()
        if self.active < 0:
            self.active = 0
开发者ID:JoelMon,项目名称:pychess,代码行数:25,代码来源:ToggleComboBox.py


示例4: __init__

 def __init__(self, icon_name):
     GObject.GObject.__init__(self)
     self.id2iter = {}
     
     self.icon_name = icon_name
     pm = Gtk.ListStore(str,str,int)
     self.props.model = pm
     self.idSet = set()
     
     self.set_headers_visible(False)
     self.set_tooltip_column(1)
     self.set_search_column(1)
     
     # First column
     crt = Gtk.CellRendererText()
     crt.props.ellipsize = Pango.EllipsizeMode.END
     self.leftcol = Gtk.TreeViewColumn("", crt, text=1)
     self.leftcol.set_expand(True)
     self.append_column(self.leftcol)
     
     # Second column
     pixbuf = load_icon(16, icon_name)
     crp = Gtk.CellRendererPixbuf()
     crp.props.pixbuf = pixbuf
     self.rightcol = Gtk.TreeViewColumn("", crp)
     self.append_column(self.rightcol)
     
     # Mouse
     self.pressed = None
     self.stdcursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
     self.linkcursor = Gdk.Cursor.new(Gdk.CursorType.HAND2)
     self.connect("button_press_event", self.button_press)
     self.connect("button_release_event", self.button_release)
     self.connect("motion_notify_event", self.motion_notify)
     self.connect("leave_notify_event", self.leave_notify)
     
     # Selection
     self.get_selection().connect("changed", self.selection_changed)
开发者ID:Alex-Linhares,项目名称:pychess,代码行数:38,代码来源:ChatWindow.py


示例5: addItem

 def addItem (self, text, stock=None):
     if stock == None:
         item = gtk.MenuItem(text)
     else:
         item = gtk.MenuItem()
         label = gtk.Label(text)
         label.props.xalign = 0
         if type(stock) == str:
             stock = load_icon(12, stock)
         image = gtk.Image()
         image.set_from_pixbuf(stock)            
         hbox = gtk.HBox()
         hbox.set_spacing(6)
         hbox.pack_start(image, expand=False, fill=False)
         hbox.add(label)
         item.add(hbox)
         hbox.show_all()
     
     item.connect("activate", self.menu_item_activate, len(self._items))
     self.menu.append(item)
     self._items += [(text, stock)]
     item.show()
     if self.active < 0: self.active = 0
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:23,代码来源:ToggleComboBox.py


示例6: get_pixbuf

from pychess.Players.Human import Human
from pychess.widgets import BoardPreview
from pychess.widgets import ionest
from pychess.widgets import ImageMenu
from pychess.widgets.BoardControl import BoardControl
from pychess.Savers import fen, pgn
from pychess.Savers.ChessFile import LoadingError
from pychess.Variants import variants
from pychess.Variants.normal import NormalBoard

#===============================================================================
# We init most dialog icons global to make them accessibly to the
# Background.Taskers so they have a similar look.
#===============================================================================
big_time = get_pixbuf("glade/stock_alarm.svg")
big_people = load_icon(48, "stock_people", "system-users")
iwheels = load_icon(24, "gtk-execute", "system-run")
ipeople = load_icon(24, "stock_people", "system-users")
inotebook = load_icon(24, "stock_notebook", "computer")
speople = load_icon(16, "stock_people", "system-users")
snotebook = load_icon(16, "stock_notebook", "computer")

weather_icons = ("clear", "clear-night", "few-clouds", "few-clouds-night", "fog", "overcast", "severe-alert", "showers-scattered", "showers", "storm")
skillToIcon = {}
# Used by TaskerManager. Put here to help synchronization
skillToIconLarge = {}
for i, icon in enumerate(weather_icons, start=1):
    skillToIcon[2*i-1] = load_icon(16, "weather-%s" % icon)
    skillToIcon[2*i] = load_icon(16, "weather-%s" % icon)
    skillToIconLarge[2*i-1] = load_icon(48, "weather-%s" % icon)
    skillToIconLarge[2*i] = load_icon(48, "weather-%s" % icon)
开发者ID:jcoffee,项目名称:pychess,代码行数:31,代码来源:newGameDialog.py


示例7: __init__

    def __init__(self, widgets):

        # Init open dialog

        opendialog = Gtk.FileChooserDialog(
            _("Open Sound File"), None, Gtk.FileChooserAction.OPEN,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN,
             Gtk.ResponseType.ACCEPT))

        for dir in self.SOUND_DIRS:
            if os.path.isdir(dir):
                opendialog.set_current_folder(dir)
                break

        soundfilter = Gtk.FileFilter()
        soundfilter.set_name(_("Sound files"))
        soundfilter.add_mime_type("audio/%s" % EXT)
        soundfilter.add_pattern("*.%s" % EXT)
        opendialog.add_filter(soundfilter)

        # Get combo icons

        icons = ((_("No sound"), "audio-volume-muted", "audio-volume-muted"),
                 (_("Beep"), "stock_bell", "audio-x-generic"),
                 (_("Select sound file..."), "gtk-open", "document-open"))

        items = []
        for level, stock, altstock in icons:
            image = load_icon(16, stock, altstock)
            items += [(image, level)]

        audioIco = load_icon(16, "audio-x-generic")

        # Set-up combos

        def callback(combobox, index):
            if combobox.get_active() == SOUND_SELECT:
                if opendialog.run() == Gtk.ResponseType.ACCEPT:
                    uri = opendialog.get_uri()
                    model = combobox.get_model()
                    conf.set("sounduri%d" % index, uri)
                    label = unquote(os.path.split(uri)[1])
                    if len(model) == 3:
                        model.append([audioIco, label])
                    else:
                        model.set(model.get_iter((3, )), 1, label)
                    combobox.set_active(3)
                else:
                    combobox.set_active(conf.get("soundcombo%d" % index,
                                                 SOUND_MUTE))
                opendialog.hide()

        for i in range(self.COUNT_OF_SOUNDS):
            combo = widgets["sound%dcombo" % i]
            uistuff.createCombo(combo, items, name="soundcombo%d" % i)
            # combo.set_active(0)
            combo.connect("changed", callback, i)

            label = widgets["soundlabel%d" % i]
            label.props.mnemonic_widget = combo

            uri = conf.get("sounduri%d" % i, "")
            if os.path.isfile(url2pathname(uri[5:])):
                model = combo.get_model()
                model.append([audioIco, unquote(os.path.split(uri)[1])])
                # combo.set_active(3)

        for i in range(self.COUNT_OF_SOUNDS):
            if conf.get("soundcombo%d" % i, SOUND_MUTE) == SOUND_URI and \
                    not os.path.isfile(url2pathname(conf.get("sounduri%d" % i, "")[5:])):
                conf.set("soundcombo%d" % i, SOUND_MUTE)
            uistuff.keep(widgets["sound%dcombo" % i], "soundcombo%d" % i)

        # Init play button

        def playCallback(button, index):
            SoundTab.playAction(index)

        for i in range(self.COUNT_OF_SOUNDS):
            button = widgets["sound%dbutton" % i]
            button.connect("clicked", playCallback, i)

        # Init 'use sound" checkbutton

        def checkCallBack(*args):
            checkbox = widgets["useSounds"]
            widgets["sounds_frame"].set_property("sensitive", checkbox.get_active())

        conf.notify_add("useSounds", checkCallBack)
        widgets["useSounds"].set_active(True)
        uistuff.keep(widgets["useSounds"], "useSounds")
        checkCallBack()

        if not self.getPlayer().ready:
            widgets["useSounds"].set_sensitive(False)
            widgets["useSounds"].set_active(False)

        uistuff.keep(widgets["alarm_spin"], "alarm_spin", first_value=15)
开发者ID:bboutkov,项目名称:pychess,代码行数:98,代码来源:preferencesDialog.py


示例8: __init__

 def __init__ (self, widgets):
     
     # Init open dialog
     
     opendialog = gtk.FileChooserDialog (
             _("Open Sound File"), None, gtk.FILE_CHOOSER_ACTION_OPEN,
              (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
               gtk.RESPONSE_ACCEPT))
     
     for dir in self.SOUND_DIRS:
         if os.path.isdir(dir):
             opendialog.set_current_folder(dir)
             break
     
     soundfilter = gtk.FileFilter()
     soundfilter.add_custom(soundfilter.get_needed(),
                            lambda data: data[3] and data[3].startswith("audio/"))
     opendialog.add_filter(soundfilter)
     opendialog.set_filter(soundfilter)
     
     # Get combo icons
     
     icons = ((_("No sound"), "audio-volume-muted", "audio-volume-muted"),
              (_("Beep"), "stock_bell", "audio-x-generic"), 
              (_("Select sound file..."), "gtk-open", "document-open"))
     
     items = []
     for level, stock, altstock in icons:
         image = load_icon(16, stock, altstock)
         items += [(image, level)]
     
     audioIco = load_icon(16, "audio-x-generic")
     
     # Set-up combos
     
     def callback (combobox, index):
         if combobox.get_active() == SOUND_SELECT:
             if opendialog.run() == gtk.RESPONSE_ACCEPT:
                 uri = opendialog.get_uri()
                 model = combobox.get_model()
                 conf.set("sounduri%d"%index, uri)
                 label = os.path.split(uri)[1]
                 if len(model) == 3:
                     model.append([audioIco, label])
                 else:
                     model.set(model.get_iter((3,)), 1, label)
                 combobox.set_active(3)
             else:
                 combobox.set_active(conf.get("soundcombo%d"%index,SOUND_MUTE))
             opendialog.hide()
     
     for i in xrange(self.COUNT_OF_SOUNDS):
         combo = widgets["soundcombo%d"%i]
         uistuff.createCombo (combo, items)
         combo.set_active(0)
         combo.connect("changed", callback, i)
         
         label = widgets["soundlabel%d"%i]
         label.props.mnemonic_widget = combo
         
         uri = conf.get("sounduri%d"%i,"")
         if os.path.isfile(uri[7:]):
             model = combo.get_model()
             model.append([audioIco, os.path.split(uri)[1]])
             combo.set_active(3)
     
     for i in xrange(self.COUNT_OF_SOUNDS):
         if conf.get("soundcombo%d"%i, SOUND_MUTE) == SOUND_URI and \
                 not os.path.isfile(conf.get("sounduri%d"%i,"")[7:]):
             conf.set("soundcombo%d"%i, SOUND_MUTE)
         uistuff.keep(widgets["soundcombo%d"%i], "soundcombo%d"%i)
         #widgets["soundcombo%d"%i].set_active(conf.get("soundcombo%d"%i, SOUND_MUTE))
     
     # Init play button
     
     def playCallback (button, index):
         SoundTab.playAction(index)
     
     for i in range (self.COUNT_OF_SOUNDS):
         button = widgets["soundbutton%d"%i]
         button.connect("clicked", playCallback, i)
     
     # Init 'use sound" checkbutton
     
     def checkCallBack (*args):
         checkbox = widgets["useSounds"]
         widgets["frame23"].set_property("sensitive", checkbox.get_active())
     conf.notify_add("useSounds", checkCallBack)
     widgets["useSounds"].set_active(True)
     uistuff.keep(widgets["useSounds"], "useSounds")
     checkCallBack()
     
     def soundError (player, gstmessage):
         widgets["useSounds"].set_sensitive(False)
         widgets["useSounds"].set_active(False)
     self.getPlayer().connect("error", soundError)
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:96,代码来源:preferencesDialog.py


示例9: __init__

    def __init__(self, gamemodel=None):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
        self.gamemodel = gamemodel

        # States for the color generator
        self.colors = {}
        self.startpoint = random.random()

        # Inits the read view
        self.readView = Gtk.TextView()
        set_textview_color(self.readView)

        self.sw = Gtk.ScrolledWindow()
        self.sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)

        self.sw.add(self.readView)
        self.readView.set_editable(False)
        self.readView.set_cursor_visible(False)
        self.readView.props.wrap_mode = Gtk.WrapMode.WORD
        self.readView.props.pixels_below_lines = 1
        self.readView.props.pixels_above_lines = 2
        self.readView.props.left_margin = 2

        if isinstance(self.gamemodel, ICGameModel):
            self.refresh = Gtk.Image()
            self.refresh.set_from_pixbuf(load_icon(16, "view-refresh",
                                                   "stock-refresh"))
            label = _("Observers")
            self.obs_btn = Gtk.Button()
            self.obs_btn.set_image(self.refresh)
            self.obs_btn.set_label(label)
            self.obs_btn.connect("clicked", self.on_obs_btn_clicked)

            vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

            # Inits the observers view
            self.obsView = Gtk.TextView()
            self.obsView.set_cursor_visible(False)
            set_textview_color(self.obsView)

            self.obsView.set_editable(False)
            self.obsView.props.wrap_mode = Gtk.WrapMode.WORD
            self.obsView.props.pixels_below_lines = 1
            self.obsView.props.pixels_above_lines = 2
            self.obsView.props.left_margin = 2

            text_buffer = self.obsView.get_buffer()
            iter = text_buffer.get_end_iter()
            anchor1 = text_buffer.create_child_anchor(iter)
            self.obsView.add_child_at_anchor(self.obs_btn, anchor1)
            self.button_tag = text_buffer.create_tag("observers")
            text_buffer.insert_with_tags_by_name(iter, " ", "observers")
            text_buffer.insert(iter, "\n")

            vbox.pack_start(self.obsView, False, True, 0)
            vbox.pack_start(self.sw, True, True, 0)

            self.pack_start(vbox, True, True, 0)
        else:
            self.pack_start(self.sw, True, True, 0)

        # Create a 'log mark' in the beginning of the text buffer. Because we
        # query the log asynchronously and in chunks, we can use this to insert
        # it correctly after previous log messages, but before the new messages.
        start = self.readView.get_buffer().get_start_iter()
        self.readView.get_buffer().create_mark("logMark", start)

        # Inits the write view
        self.writeView = Gtk.Entry()
        self.pack_start(self.writeView, False, False, 0)

        self.writeView.connect("key-press-event", self.onKeyPress)
开发者ID:CarbonFixer,项目名称:pychess,代码行数:73,代码来源:ChatView.py


示例10: load_icon

from pychess.System.prefix import getDataPrefix, isInstalled, addDataPrefix
from pychess.Players.engineNest import discoverer
from pychess.Players.Human import Human
from pychess.widgets import BoardPreview
from pychess.widgets import ionest
from pychess.widgets import ImageMenu
from pychess.Savers import pgn
from pychess.Variants import variants
from pychess.Variants.normal import NormalChess

#===============================================================================
# We init most dialog icons global to make them accessibly to the
# Background.Taskers so they have a similar look.
#===============================================================================

big_time = load_icon(48, "stock_alarm", "appointment-soon")
big_people = load_icon(48, "stock_people", "system-users")
iwheels = load_icon(24, "gtk-execute")
ipeople = load_icon(24, "stock_people", "system-users")
inotebook = load_icon(24, "stock_notebook", "computer")
speople = load_icon(16, "stock_people", "system-users")
snotebook = load_icon(16, "stock_notebook", "computer")

skillToIcon = {
    1: load_icon(16, "weather-clear"),
    2: load_icon(16, "weather-few-clouds"),
    3: load_icon(16, "weather-few-clouds"),
    4: load_icon(16, "weather-overcast"),
    5: load_icon(16, "weather-overcast"),
    6: load_icon(16, "weather-showers"),
    7: load_icon(16, "weather-showers"),
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:31,代码来源:newGameDialog.py


示例11: load_icon

from pychess.perspectives.database.OpeningTreePanel import OpeningTreePanel
from pychess.perspectives.database.FilterPanel import FilterPanel
from pychess.perspectives.database.PreviewPanel import PreviewPanel
from pychess.System.prefix import addUserConfigPrefix
from pychess.widgets.pydock.PyDockTop import PyDockTop
from pychess.widgets.pydock import EAST, SOUTH, CENTER
from pychess.widgets import mainwindow, new_notebook, createImage, createAlignment, gtk_close
from pychess.widgets import gamewidget
from pychess.Database.model import create_indexes, drop_indexes
from pychess.Database.PgnImport import PgnImport, download_file
from pychess.Database.JvR import JvR
from pychess.Savers import fen, epd, olv
from pychess.Savers.pgn import PGNFile
from pychess.System.protoopen import protoopen

pgn_icon = load_icon(24, "application-x-chess-pgn", "pychess")


class Database(GObject.GObject, Perspective):
    __gsignals__ = {
        'chessfile_opened0': (GObject.SignalFlags.RUN_FIRST, None, (object, )),
        'chessfile_opened': (GObject.SignalFlags.RUN_FIRST, None, (object, )),
        'chessfile_closed': (GObject.SignalFlags.RUN_FIRST, None, ()),
        'chessfile_imported': (GObject.SignalFlags.RUN_FIRST, None, (object, )),
    }

    def __init__(self):
        GObject.GObject.__init__(self)
        Perspective.__init__(self, "database", _("Database"))
        self.widgets = gamewidget.getWidgets()
        self.first_run = True
开发者ID:teacoffee2017,项目名称:pychess,代码行数:31,代码来源:__init__.py


示例12: on_get_size

        context.rectangle (x+1.5, y+1.5, self.width-3, self.height-3)
        context.stroke ()

    def on_get_size(self, widget, cell_area=None):
        if cell_area:
            y = int(cell_area.height/2.-self.height/2.) + cell_area.y
            x = cell_area.x
        else:
            y = 0
            x = 0
        return (x+1, y+1, self.width+2, self.height+2)

GObject.type_register(BulletCellRenderer)


add_icon = load_icon(16, "gtk-add", "list-add")
remove_icon = load_icon(16, "gtk-remove", "list-remove")

class TextImageTree (Gtk.TreeView):
    """ Defines a tree with two columns.
        The first one has text. The seccond one a clickable stock_icon """

    __gsignals__ = {
        'activated' : (GObject.SignalFlags.RUN_FIRST, None, (str,str,int)),
        'selected' : (GObject.SignalFlags.RUN_FIRST, None, (str,int))
    }

    def __init__(self, icon):
        GObject.GObject.__init__(self)
        self.id2iter = {}
开发者ID:sally0813,项目名称:pychess,代码行数:30,代码来源:ChatWindow.py


示例13: createImage

    notebook = Gtk.Notebook()
    if name is not None:
        notebook.set_name(name)
    notebook.get_tab_label_text = customGetTabLabelText
    notebook.set_show_tabs(False)
    notebook.set_show_border(False)
    return notebook


def createImage(pixbuf):
    image = Gtk.Image()
    image.set_from_pixbuf(pixbuf)
    return image


light_on = load_icon(16, "stock_3d-light-on", "weather-clear")
light_off = load_icon(16, "stock_3d-light-off", "weather-clear-night")
gtk_close = load_icon(16, "gtk-close", "window-close")

media_previous = load_icon(24, "gtk-media-previous-ltr", "media-skip-backward")
media_rewind = load_icon(24, "gtk-media-rewind-ltr", "media-seek-backward")
media_forward = load_icon(24, "gtk-media-forward-ltr", "media-seek-forward")
media_next = load_icon(24, "gtk-media-next-ltr", "media-skip-forward")
media_eject = load_icon(24, "player-eject", "media-eject")

path = prefix.addDataPrefix("sidepanel")
postfix = "Panel.py"
files = [f[:-3] for f in os.listdir(path) if f.endswith(postfix)]
sidePanels = [imp.load_module(f, *imp.find_module(f, [path])) for f in files]

dockLocation = addUserConfigPrefix("pydock.xml")
开发者ID:CarbonFixer,项目名称:pychess,代码行数:31,代码来源:gamewidget.py


示例14: load

    def load(self, widgets, connection, lounge):
        self.widgets = widgets
        self.connection = connection
        self.lounge = lounge

        __widget__ = lounge.games_list

        self.games = {}
        self.recpix = load_icon(16, "media-record")
        self.clearpix = get_pixbuf("glade/board.png")
        self.tv = self.widgets["gametreeview"]
        self.store = Gtk.ListStore(FICSGame, GdkPixbuf.Pixbuf, str, int, str,
                                   int, str, str)

        self.game_filter = self.store.filter_new()
        self.game_filter.set_visible_func(self.game_filter_func)

        self.filter_toggles = {}
        self.filter_buttons = ("standard_toggle", "blitz_toggle", "lightning_toggle", "variant_toggle")
        for widget in self.filter_buttons:
            uistuff.keep(self.widgets[widget], widget)
            self.widgets[widget].connect("toggled", self.on_filter_button_toggled)
            initial = conf.get(widget, True)
            self.filter_toggles[widget] = initial
            self.widgets[widget].set_active(initial)

        self.model = self.game_filter.sort_new_with_model()
        self.tv.set_model(self.model)
        self.tv.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
        self.addColumns(self.tv,
                        "FICSGame",
                        "",
                        _("White"),
                        _("Rating"),
                        _("Black"),
                        _("Rating"),
                        _("Type"),
                        _("Rated"),
                        hide=[0],
                        pix=[1])

        self.tv.get_model().set_sort_func(0, self.pixCompareFunction, 1)
        for i in range(1, 7):
            self.tv.get_model().set_sort_func(i, self.compareFunction, i)
        self.prev_sort_column_id = []
        self.model.connect("sort-column-changed", self.on_sort_column_change)

        self.tv.set_has_tooltip(True)
        self.tv.connect("query-tooltip", self.on_query_tooltip)
        self.selection = self.tv.get_selection()
        self.selection.connect("changed", self.onSelectionChanged)
        self.onSelectionChanged(self.selection)

        try:
            self.tv.set_search_position_func(self.lowLeftSearchPosFunc, None)
        except AttributeError:
            # Unknow signal name is raised by gtk < 2.10
            pass

        def searchCallback(model, column, key, sel_iter, user_data):
            if model.get_value(sel_iter, 2).lower().startswith(key) or \
                    model.get_value(sel_iter, 4).lower().startswith(key):
                return False
            return True

        self.tv.set_search_equal_func(searchCallback, None)

        self.connection.games.connect("FICSGameCreated", self.onGameAdd)
        self.connection.games.connect("FICSGameEnded", self.onGameRemove)
        self.widgets["observeButton"].connect("clicked", self.on_observe)
        self.tv.connect("row-activated", self.on_observe)
        self.connection.bm.connect("obsGameCreated", self.onGameObserved)
        self.connection.bm.connect("obsGameUnobserved", self.onGameUnobserved)

        self.tv.connect('button-press-event', self.button_press_event)
        self.createLocalMenu((OBSERVE, FOLLOW, SEPARATOR, FINGER, ARCHIVED))

        return __widget__
开发者ID:teacoffee2017,项目名称:pychess,代码行数:78,代码来源:GameListPanel.py


示例15: get_pixbuf

from pychess.widgets import ImageMenu
from pychess.widgets import mainwindow
from pychess.widgets.BoardControl import BoardControl
from pychess.Savers import fen, pgn
from pychess.Savers.ChessFile import LoadingError
from pychess.Variants import variants
from pychess.Variants.normal import NormalBoard
from pychess.perspectives import perspective_manager
from pychess.perspectives.games import enddir

# ===============================================================================
# We init most dialog icons global to make them accessibly to the
# Background.Taskers so they have a similar look.
# ===============================================================================
big_time = get_pixbuf("glade/stock_alarm.svg")
big_people = load_icon(48, "stock_people", "system-users")
iwheels = load_icon(24, "gtk-execute", "system-run")
ipeople = load_icon(24, "stock_people", "system-users")
inotebook = load_icon(24, "stock_notebook", "computer")

weather_icons = ("clear", "clear-night", "few-clouds", "few-clouds-night",
                 "fog", "overcast", "severe-alert", "showers-scattered",
                 "showers", "storm")
skillToIcon = {}
# Used by TaskerManager. Put here to help synchronization
skillToIconLarge = {}
for i, icon in enumerate(weather_icons, start=1):
    skillToIcon[2 * i - 1] = get_pixbuf("glade/16x16/weather-%s.png" % icon)
    skillToIcon[2 * i] = get_pixbuf("glade/16x16/weather-%s.png" % icon)
    skillToIconLarge[2 * i - 1] = get_pixbuf("glade/48x48/weather-%s.png" % icon)
    skillToIconLarge[2 * i] = get_pixbuf("glade/48x48/weather-%s.png" % icon)
开发者ID:leogregianin,项目名称:pychess,代码行数:31,代码来源:newGameDialog.py


示例16: __init__

    def __init__ (self, gamemodel=None):
        GObject.GObject.__init__(self)
        self.gamemodel = gamemodel

        # States for the color generator
        self.colors = {}
        self.startpoint = random.random()

        # Inits the read view
        self.readView = Gtk.TextView()
        #self.readView.set_size_request(-1, 30)
        set_textview_color(self.readView)

        sw1 = Gtk.ScrolledWindow()
        sw1.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        sw1.set_shadow_type(Gtk.ShadowType.NONE)
        #sw1.set_size_request(-1, 300)
        uistuff.keepDown(sw1)

        sw1.add(self.readView)
        self.readView.set_editable(False)
        self.readView.set_cursor_visible(False)
        self.readView.props.wrap_mode = Gtk.WrapMode.WORD
        self.readView.props.pixels_below_lines = 1
        self.readView.props.pixels_above_lines = 2
        self.readView.props.left_margin = 2
        #self.readView.get_buffer().create_tag("log",
        #        foreground = self.readView.get_style().fg[Gtk.StateType.INSENSITIVE])

        if isinstance(self.gamemodel, ICGameModel):
            self.refresh = Gtk.Image()
            self.refresh.set_from_pixbuf(load_icon(16, "view-refresh", "stock-refresh"))

            vp = Gtk.VPaned()

            # Inits the observers view
            self.obsView = Gtk.TextView()
            self.obsView.set_cursor_visible(False)
            #self.obsView.set_size_request(-1, 3)
            set_textview_color(self.obsView)

            sw0 = Gtk.ScrolledWindow()
            sw0.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            sw0.set_shadow_type(Gtk.ShadowType.NONE)
            sw0.set_size_request(-1, 3)
            uistuff.keepDown(sw0)
            sw0.add(self.obsView)
            self.obsView.set_editable(False)
            self.obsView.props.wrap_mode = Gtk.WrapMode.WORD
            self.obsView.props.pixels_below_lines = 1
            self.obsView.props.pixels_above_lines = 2
            self.obsView.props.left_margin = 2

            vp.pack1(BorderBox(sw0, bottom=True), resize=False, shrink=False)
            vp.pack2(BorderBox(sw1, top=True), resize=True, shrink=False)

            self.pack1(BorderBox(vp, bottom=True), resize=True, shrink=True)
        else:
            self.pack1(BorderBox(sw1, bottom=True), resize=True, shrink=True)

        # Create a 'log mark' in the beginning of the text buffer. Because we
        # query the log asynchronously and in chunks, we can use this to insert
        # it correctly after previous log messages, but before the new messages.
        start = self.readView.get_buffer().get_start_iter()
        self.readView.get_buffer().create_mark("logMark", start)

        # Inits the write view
        self.writeView = Gtk.TextView()
        set_textview_color(self.writeView)

        sw2 = Gtk.ScrolledWindow()
        sw2.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        sw2.set_shadow_type(Gtk.ShadowType.NONE)
        sw2.set_size_request(-1, 3)
        sw2.add(self.writeView)
        self.writeView.props.wrap_mode = Gtk.WrapMode.WORD
        self.writeView.props.pixels_below_lines = 1
        self.writeView.props.pixels_above_lines = 2
        self.writeView.props.left_margin = 2
        self.pack2(BorderBox(sw2, top=True), resize=False, shrink=False)

        # Forces are reasonable position for the panner.
        def callback (widget, ctx):
            widget.disconnect(handle_id)
            allocation = widget.get_allocation()
            self.set_position(int(max(0.70*allocation.height, allocation.height-60)))
        handle_id = self.connect("draw", callback)

        self.writeView.connect("key-press-event", self.onKeyPress)
开发者ID:ggjj1122,项目名称:pychess,代码行数:89,代码来源:ChatView.py


示例17: _

            name = conf.get("secondName", _("Guest"))
            player1tup = (LOCAL, Human, (1 - color, name), name)
        else:
            engine = discoverer.getEngineN(opponent - 1)
            name = discoverer.getName(engine)
            player1tup = (ARTIFICIAL, discoverer.initPlayerEngine,
                          (engine, 1 - color, difficulty,
                           variants[NORMALCHESS], 5 * 60, 0), name)

        if color == WHITE:
            ionest.generalStart(gamemodel, player0tup, player1tup)
        else:
            ionest.generalStart(gamemodel, player1tup, player0tup)


big_start = load_icon(48, "stock_init", "gnome-globe", "applications-internet")


class InternetGameTasker(Gtk.Alignment):
    def __init__(self):
        #GObject.GObject.__init__(self,0,0,0,0)
        GObject.GObject.__init__(self)
        self.widgets = uistuff.GladeWidgets("taskers.glade")
        tasker = self.widgets["internetGameTasker"]
        tasker.unparent()
        self.add(tasker)

        def asGuestCallback(check):
            names = ICLogon.get_user_names()
            self.widgets["usernameEntry"].set_text(names[1] \
                                                   if check.get_active() else names[0])
开发者ID:vaj25,项目名称:pychess,代码行数:31,代码来源:TaskerManager.py


示例18: cleanNotebook

    align.set_property("bottom-padding", bottom)
    align.set_property("left-padding", left)
    return align

def cleanNotebook ():
    notebook = Gtk.Notebook()
    notebook.set_show_tabs(False)
    notebook.set_show_border(False)
    return notebook

def createImage (pixbuf):
    image = Gtk.Image()
    image.set_from_pixbuf(pixbuf)
    return image

light_on = load_icon(16, "stock_3d-light-on", "weather-clear")
light_off = load_icon(16, "stock_3d-light-off", "weather-clear-night")
gtk_close = load_icon(16, "gtk-close")

media_previous = load_icon(16, "gtk-media-previous-ltr")
media_rewind = load_icon(16, "gtk-media-rewind-ltr")
media_forward = load_icon(16, "gtk-media-forward-ltr")
media_next = load_icon(16, "gtk-media-next-ltr")

path = prefix.addDataPrefix("sidepanel")
postfix = "Panel.py"
files = [f[:-3] for f in os.listdir(path) if f.endswith(postfix)]
sidePanels = [imp.load_module(f, *imp.find_module(f, [path])) for f in files]

dockLocation = addUserConfigPrefix("pydock.xml")
开发者ID:Alex-Linhares,项目名称:pychess,代码行数:30,代码来源:gamewidget.py



注:本文中的pychess.Utils.IconLoader.load_icon函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logic.validate函数代码示例发布时间:2022-05-25
下一篇:
Python IconLoader.get_pixbuf函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap