compile a python3 project with autotools

Chris Angelico rosuav at gmail.com
Mon Aug 15 02:34:04 EDT 2016


On Mon, Aug 15, 2016 at 7:23 AM,  <bnrj.rudra at gmail.com> wrote:
> #!/usr/bin/env python3
>
> import sys
> sys.path.insert(1, '@pythondir@')
>
> from mkbib.main import mkbib
> if __name__ == "__main__":
>     app = mkbib()
>     r = app.run()
>     sys.exit(r)
>
>
> Now, the problem is it is compiling fine (make; make install goes without any error)
>
> make --silent
> Making all in data
> Making all in icons
> Making all in hicolor
> Making all in 48x48
> Making all in apps
> Making all in scalable
> Making all in apps
> Making all in ui
> Making all in src
> Making all in Mkbib
>
> but while running the application, I am getting error:
> (mkbib:14843): Gtk-CRITICAL **: New application windows must be added after the GApplication::startup signal has been emitted.
>

On Mon, Aug 15, 2016 at 4:23 PM, Rudra Banerjee <bnrj.rudra at live.com> wrote:
> It fails to close, if I run it from command line. Also, even if I close it by close button, the  command line does not return.

When you build Mkbib, is it supposed to run the app immediately? That
appears to be what's happening.

Also, your code seems to have some odd redundancies:

> src/Mkbib/main.py is the main program. This is structured as:
>
> class mkbib(Gtk.Application):
>     def __init__(self):
>         Gtk.Application.__init__(self)

You shouldn't need this. All it does is call the superclass's
initializer with the same arguments. The net result is that your class
plays poorly with multiple inheritance (probably not going to hurt you
here, but if ever you did use MI, this would bite you), and other than
that, no significant effect. Omit this function altogether unless you
actually need to initialize.

>     def new_window(self, filename=None):
>         window = Window(self)
>         window.show_all()

What's the filename do?

>     def run(self):
>         self.new_window()
>         Gtk.main()
>

This is what's sometimes called a "procedure" - a function that
doesn't have any meaningful return value. (When you run off the end of
the function, Python assumes a "return None". Since it has no other
return statements, this function will never return anything other than
None.) But in mkbib.in, you call it as a function - "r = app.run()".
Possibly not what you intended?

Generally, I would expect the 'make' process to not be invoking your
app, but perhaps I'm misunderstanding what mkbib.in does or when it's
invoked.

ChrisA



More information about the Python-list mailing list