gtk_file_chooser_dialog in windows - hot to enable network places

2018-05-09 Thread Wojciech Puchar
tried gtk_file_chooser_set_local_only to false and it doesn't change 
anything.



Is it possible for gtk_file_chooser under windows to be able to browse 
network locations?


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: [PyGObject] TreeView: Empty integer field or right aligned string

2018-05-09 Thread Luca Bacci
in python you can do

def cell_data_func(self, tree_column, cell, tree_model, iter, data):
if tree_column is self.col_a:
# code
else if tree_column is self.col_b:
# code

see How do I check if two variables reference the same object in Python?

you have make col_a and col_b class members


But I think it's better to just write two functions:

#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Pango

class TreeView(Gtk.TreeView):
def __init__(self, model):
Gtk.TreeView.__init__(self, model)

cell_a = Gtk.CellRendererText()
col_a = Gtk.TreeViewColumn('int',
   cell_a)
col_a.set_cell_data_func(cell_a, self.func_a, None)
self.append_column(col_a)

cell_b = Gtk.CellRendererText()
col_b = Gtk.TreeViewColumn('str',
   cell_b)
col_b.set_cell_data_func(cell_b, self.func_b, None)
self.append_column(col_b)

def func_a(self, tree_column, cell, tree_model, tree_iter, data):
cur_value = tree_model[tree_iter][0]
if cur_value == 0:
cell.set_property('text', '')
else:
cell.set_property('text', str(cur_value))

def func_b(self, tree_column, cell, tree_model, tree_iter, data):
cell.set_property('text', tree_model[tree_iter][1])

class TreeModel(Gtk.ListStore):
def __init__(self):
Gtk.ListStore.__init__(self, int, str)

# int and string
self.append([1, '111'])

# first column "empty" but displayed as "0"
# second column "empty" (but a workaround)
self.append([0, 'Hi!'])

# RIGHT alignment (second column) not working
self.append([3, '3'])


class Window(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title='Mein Gtk-Fenster')
self.set_default_size(400, 300)

self.model = TreeModel()
self.view = TreeView(self.model)

# layout
self.layout = Gtk.Grid()
self.add(self.layout)
self.layout.attach(self.view, 0, 1, 1, 1)

self.connect('destroy', Gtk.main_quit)
self.show_all()

if __name__ == '__main__':
win = Window()
Gtk.main()



2018-05-08 22:09 GMT+02:00 :

> On 2018-05-08 14:20 Luca Bacci  wrote:
> >- Use Cell Data Func for ultimate flexibility
>
> That is the signature
>  Gtk.TreeCellDataFunc(tree_column, cell, tree_model, iter, data)
>
> But how do I know which cell (row and column) is affected?
> I can extrat the row with tree_model[iter] but not the column.
>
> "tree_column" is of type Gtk.TreeViewColumn but doesn't even know its
> position (first, second, ... column). There is no integer indicating
> that.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


PyGObject: Spinner as content of a TreeView cell

2018-05-09 Thread c.buhtz
Does anyone see a way to draw/insert a Gtk.Spinner (or any other
Gtk.Widget) in a cell of a Gtk.TreeView?

I want to use a Spinner to indicate to the user that currently there is
work (e. g. ongoing download) or activity with a specific item.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: PyGObject: Spinner as content of a TreeView cell

2018-05-09 Thread c.buhtz
On 2018-05-09 22:52  wrote:
> Does anyone see a way to draw/insert a Gtk.Spinner (or any other
> Gtk.Widget) in a cell of a Gtk.TreeView?

Oh, there is a CellRendererSpinner for it! :)
An example can be found here


But I don't get it and opened a StackOverflow question for it because
my spinner doesn't spin.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


PyGObject: Which types accepted in a Gtk.ListStore

2018-05-09 Thread c.buhtz
>From the api-reference here


it is unclear for me what types are accepted for the columns.
The parameter "*column_types" is not explained.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


PyGObject: cell_data_func or own Renderer for date column?

2018-05-09 Thread c.buhtz
I want to have a date column in a Gtk.ListView. The field in the model
is a real "datetime.date". Based on that the content of the column
could display this:

  "2018-05-07"
  "2 days ago"
  "this week"
  "7th May"
  "7. Mai '18"

This is all based on the same "datetime.date" instance. The user decide
how to display. So I need maximum flexibility.

A cell_data_function is an option here to implement this. Is it a good
choice?

What is about deriving from Gtk.CellRendererText?
But I don't see how to do this. May I only overload the render()
function? But how can I read from datetime.date object and convert it
to a string?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list