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

2018-05-08 Thread c.buhtz
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


Re: Why would I see g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed?

2018-05-08 Thread Brendan Long
In case anyone else finds this in a Google search in the future, this was an 
interaction between Vala and libpeas. If you annotate a function with 
[ModuleInit] like we do here: 
https://github.com/jangernert/FeedReader/blob/master/plugins/backend/feedbin/feedbinInterface.vala#L750
 
,
 then link it into a library, the Vala compiler magically turns the entire 
library into a libpeas module. Since I was directly linking the module, the 
peas_register_types function wasn't being called and the types didn't exist.

I couldn't figure out how to call that function manually, so we just don't link 
that peas_register_types function 

 in our tests. Long term we'll probably just have a file with nothing but that 
function so we can test everything else easily.

> On Apr 22, 2018, at 12:56 PM, Brendan Long  wrote:
> 
> I'm not sure if this is a Glib, Meson or Vala thing, but I don't even 
> understand why this glib error would ever happen so I hope this is the right 
> place to ask (I know it means "this type is null", but I have no idea why 
> that would ever be the case).
> 
> I'm trying to convert a Vala project that uses dynamically loaded plugins to 
> Meson:
> 
> https://github.com/jangernert/FeedReader/pull/662 
> 
> 
> For some reason, linking a test exectable with one of our plugins causes 
> errors like:
> 
> $ ./plugins/backend/feedbin/test_feedbin
> /feedbinapi/construct: 
> (./plugins/backend/feedbin/test_feedbin:27002): GLib-GObject-CRITICAL **: 
> g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' 
> failed
> Trace/breakpoint trap (core dumped)
> 
> The file is just a simple class that extends GLib.object: 
> https://github.com/brendanlong/FeedReader/blob/meson/plugins/backend/feedbin/feedbinAPI.vala
>  
> 
> The meson build is here, if that matters: 
> https://github.com/brendanlong/FeedReader/blob/meson/plugins/backend/feedbin/meson.build
>  
> 
> 
> We were getting similar issues when linking our main library statically, but 
> it's a shared library now (and the plugin has always been a shared library).
> 
> The only things I could find on Google were versioning issues, but I get this 
> error in Docker, where no other version of FeedReader is installed:
> 
> https://circleci.com/gh/brendanlong/FeedReader/206 
> 
> 
> Can someone help me understand what's going wrong, and what I might do to fix 
> it? 
> 

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


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

2018-05-08 Thread Luca Bacci
To have empty int cells, you can either

   - use strings, instead of ints, in ListStore as you said
   - make place for a third value in ListStore, of type bool, and control
   the "visible" property of the first Cell Renderer with it (see code below)
   - Use Cell Data Func for ultimate flexibility

And here's the code

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

class TreeView(Gtk.TreeView):
def __init__(self, model):
Gtk.TreeView.__init__(self, model)
col_a = Gtk.TreeViewColumn('int',
   Gtk.CellRendererText(),
   text=0,
   visible=2)
self.append_column(col_a)
col_b = Gtk.TreeViewColumn('str',
   Gtk.CellRendererText(),
   text=1)
self.append_column(col_b)


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

self.append([1, '111', True])
self.append([0, 'Hi!', False])
self.append([3, '3',   True])


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()

Luca

2018-05-08 12:08 GMT+02:00 Luca Bacci :

> Hello!
>
> You can achieve what you want with the "xalign" property of CellRenderers
>
> col_b = Gtk.TreeViewColumn('str',
>Gtk.CellRendererText(xalign=1),
>text=1)
>
> xalign takes a value between 0 and 1.
> xalign=0 -> left-justified
> xalign=1 -> right-justified
>
> Luca
>
>
> 2018-05-06 12:01 GMT+02:00 :
>
>> X-Post: https://stackoverflow.com/q/50194505/4865723
>>
>> I want to have in a Gtk.TreeView
>>
>> - empty cells in a "int row" of a TreeView
>> - or (as a workaround) a right aligned "string row"
>>
>> There is a screenshot and example code in the StackOverflow question
>> linked in the first line of this post.
>>
>> The problem is
>>
>> - When I give 'None' to a 'int row' a '0' is displayed. I would
>>   expect an empty cell. I want that cell to be
>>   absolute empty.
>>
>> - A workaround is to use strings instead of int and just display the
>>   numbers as strings doing str(int).
>>   But then the content of each cell is left aligned by default.
>>   I tried to modify that. But this also has no effect.
>>
>> I attached the full example.
>> ___
>> 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


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

2018-05-08 Thread Luca Bacci
Hello!

You can achieve what you want with the "xalign" property of CellRenderers

col_b = Gtk.TreeViewColumn('str',
   Gtk.CellRendererText(xalign=1),
   text=1)

xalign takes a value between 0 and 1.
xalign=0 -> left-justified
xalign=1 -> right-justified

Luca


2018-05-06 12:01 GMT+02:00 :

> X-Post: https://stackoverflow.com/q/50194505/4865723
>
> I want to have in a Gtk.TreeView
>
> - empty cells in a "int row" of a TreeView
> - or (as a workaround) a right aligned "string row"
>
> There is a screenshot and example code in the StackOverflow question
> linked in the first line of this post.
>
> The problem is
>
> - When I give 'None' to a 'int row' a '0' is displayed. I would
>   expect an empty cell. I want that cell to be
>   absolute empty.
>
> - A workaround is to use strings instead of int and just display the
>   numbers as strings doing str(int).
>   But then the content of each cell is left aligned by default.
>   I tried to modify that. But this also has no effect.
>
> I attached the full example.
> ___
> 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


Re: Is it possible to catch ALT+TAB and do nothing

2018-05-08 Thread Carsten Mattner
It sounds like you have a kiosk application that is using a
terminal emulator, maybe xterm specifically for complete VT
compatibility, and has no other interactive application.

If that's the case and X proves hard to make work, I can suggest
running a terminal emulator like the new generation of kmscon
whose name I don't remember or Enlightenment's Terminology, as
both run on top of KMS/DRM. No need for a display manager. If
you combine it with a terminal locker, it should provide the
solution you're looking for.

If, however, you run more than xterm and need to spawn a few
X apps now and then, this wont' work. Terminology is quite
capable and might replace any image/video viewing needs you
maybe have.
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: Is it possible to catch ALT+TAB and do nothing

2018-05-08 Thread Gergely Polonkai
Given your earlier mails, the thing you want to achieve is near to
impossible. Even if you donʼt give focus to every terminal app that can
ever exist, I can press Ctrl-Alt-F2 to go to the textual console and do
whatever Iʼd like. If there is one thing in the X world you canʼt catch is
this (and maybe Ctrl-Alt-Backspace). Of course, you can disable those in
the X config. If a regular user can install software on the machine, you
stand no chance; even without root access it is possible.

If you donʼt want the user to interact with the computer at a specific
time, why not firing up the password protected screen saver?

On Tue, May 8, 2018, 00:46 James Cameron  wrote:

> On Mon, May 07, 2018 at 05:03:40PM -0500, Igor Korot wrote:
> > James,
> >
> > On Mon, May 7, 2018 at 4:46 PM, James Cameron  wrote:
> > > On Mon, May 07, 2018 at 04:27:57PM -0500, Igor Korot wrote:
> > >> Paul et al,
> > >> Any idea how to configure FVWM to not to give focus to xterm if one
> > >> specific window is displayed?
> > >
> > > You might ask on an fvwm mailing list, but fvwm does have a
> > > NeverFocus method that can be applied to an application such as xterm.
> >
> > Yes, just subscribed to their forum and will ask that question.
> > >
> > > http://www.fvwm.org/documentation/manpages/fvwm.html
> > >
> > > But that would just fix your problem for xterm; to enforce focus for a
> > > lock screen, there's more to do.  Have a look at the code for other
> > > lock screens to find out what that is.
> >
> > We do not provide any external application where the user can interact
> > with the keyboard/focus handling
> > in order to try and guess the information that should be secured.
> > Only the xterm is a concern.
>
> If this is an embedded system or kiosk application, replace xterm with
> something of your own making that uses libvte as a widget.  That way
> you can assert full control over when the widget is visible.
>
> I've found VTE acceptable for most use cases I've thrown at it.
>
> Though I still use xterm when I can.
>
> > [...]
>
> --
> James Cameron
> http://quozl.netrek.org/
> ___
> gtk-list mailing list
> gtk-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-list
>
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list