Turecko-americká vycházející matematická hvězda Levent Alpöge ze společnosti Anthropic vyvolal pozdvižení oznámením (PDF), že s pomocí superinteligence Claude od Antropicu dokázal vyřešit jeden ze sedmi největších matematických problémů tisíciletí, slavnou Riemannovu hypotézu (prvočísla se mezi čísly objevují zdánlivě nepravidelně, hypotéza tvrdí, že za jejich rozmístěním je určitý řád). Svůj důkaz uvolnil jako open-source
… více »Skotský vývojář Mike Lothian pozastavil vývoj svého otevřeného ovladače Vino (nedostupné) pro dokovací stanice DisplayLink poté, co mu Synaptics v reakci na žádost o pomoc pohrozil žalobou kvůli údajnému porušování patentů. Firma nejprve předložila seznam 125 patentů bez specifikace, které konkrétně měl ovladač porušovat, a následně požadovala 25 tisíc dolarů za náklady na jejich přiřazení ke kódu s hrozbou, že se tato částka bude
… více »Zdravím, nejde mi rozchodit v Python 2.7.* a GTK+ (gi.repository) DnD mezi dvěma iconview, netuší někdo, kde by mohl být problém?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gi.repository import Gtk, Gdk
from gi.repository.GdkPixbuf import Pixbuf
(TARGET_ENTRY_TEXT, TARGET_ENTRY_PIXBUF) = range(2)
(COLUMN_TEXT, COLUMN_PIXBUF) = range(2)
DRAG_ACTION = Gdk.DragAction.COPY
icons = ["gtk-cut", "gtk-paste", "gtk-copy"]
win = Gtk.Window()
content = Gtk.VBox()
#source view
liststore = Gtk.ListStore(Pixbuf, str)
sourceview = Gtk.IconView.new()
sourceview.set_model(liststore)
sourceview.set_pixbuf_column(0)
sourceview.set_text_column(1)
sourceview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [],
DRAG_ACTION)
def on_drag_data_get( widget, drag_context, data, info, time):
selected_path = self.get_selected_items()[0]
selected_iter = self.get_model().get_iter(selected_path)
print widget.get_model().get_iter(selected_iter, 1)
sourceview.connect("drag-data-get", on_drag_data_get)
for icon in icons:
pixbuf = Gtk.IconTheme.get_default().load_icon(icon, 64, 0)
liststore.append([pixbuf, "Label"])
content.add(sourceview)
#target view
targetstore = Gtk.ListStore(Pixbuf, str)
targetstore.append([Gtk.IconTheme.get_default().load_icon("gtk-save", 64,0), "X"])
targetview = Gtk.IconView.new()
targetview.set_model(targetstore)
targetview.set_pixbuf_column(0)
targetview.set_text_column(1)
targetview.drag_dest_set(Gtk.DestDefaults.ALL, [], DRAG_ACTION)
def on_drag_data_received(self, widget, drag_context, x,y, data,info, time):
text = data.get_text()
print("Received text: %s" % text)
targetview.connect("drag-data-received", on_drag_data_received)
content.add(targetview)
win.add(content)
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gi.repository import Gtk, Gdk
from gi.repository.GdkPixbuf import Pixbuf
(TARGET_ENTRY_TEXT, TARGET_ENTRY_PIXBUF) = range(2)
(COLUMN_TEXT, COLUMN_PIXBUF) = range(2)
DRAG_ACTION = Gdk.DragAction.COPY
icons = ["gtk-cut", "gtk-paste", "gtk-copy"]
win = Gtk.Window()
content = Gtk.VBox()
#source view
liststore = Gtk.ListStore(Pixbuf, str)
sourceview = Gtk.IconView.new()
sourceview.set_model(liststore)
sourceview.set_pixbuf_column(0)
sourceview.set_text_column(1)
sourceview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [],
DRAG_ACTION)
def on_drag_data_get( widget, drag_context, data, info, time):
selected_path = self.get_selected_items()[0]
selected_iter = self.get_model().get_iter(selected_path)
print widget.get_model().get_iter(selected_iter, 1)
sourceview.connect("drag-data-get", on_drag_data_get)
for icon in icons:
pixbuf = Gtk.IconTheme.get_default().load_icon(icon, 64, 0)
liststore.append([pixbuf, "Label"])
content.add(sourceview)
#target view
targetstore = Gtk.ListStore(Pixbuf, str)
targetstore.append([Gtk.IconTheme.get_default().load_icon("gtk-save", 64,0), "X"])
targetview = Gtk.IconView.new()
targetview.set_model(targetstore)
targetview.set_pixbuf_column(0)
targetview.set_text_column(1)
targetview.drag_dest_set(Gtk.DestDefaults.ALL, [], DRAG_ACTION)
def on_drag_data_received(self, widget, drag_context, x,y, data,info, time):
text = data.get_text()
print("Received text: %s" % text)
targetview.connect("drag-data-received", on_drag_data_received)
content.add(targetview)
win.add(content)
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
Tiskni
Sdílej: