<div dir="ltr"><div>Right now I don't have any way of changing it, since it won't run otherwise. However, I'm operating in fear that I'm creating a subtle problem that will leave me debugging through trial and error for days due to some definition redefining another without warning. This happened before I had the namespace and directory imports, and was driving me insane.</div><div><br></div>Do you know of any examples of larger project structures for working with PyQt and QML? I've been following the examples at <a href="https://github.com/baoboa/pyqt5/tree/master/examples/quick/tutorials/extending">https://github.com/baoboa/pyqt5/tree/master/examples/quick/tutorials/extending</a>, but since they are condensed in the minimum number of files, they don't demonstrate how to architect a project. I've had a hard time finding any examples of larger PyQt hybrid apps online.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 8, 2016 at 9:36 AM Cody Scott <<a href="mailto:cody@perspexis.com">cody@perspexis.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">This is strange. You shouldn't need to import anything in components/MainBus.qml to access MainBusButton {} since MainBusButton.qml is in the components/ directory.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">One thing is that you are registering MainBusButton in Python and it is also registered when you import components. So it seems to me that you are registering the same type twice.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">But the component you are using has characteristics of both. And it is working.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Let me know if you end up changing it.</div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Wed, Dec 7, 2016 at 9:34 PM, Louis Simons <span dir="ltr" class="gmail_msg"><<a href="mailto:lousimons@gmail.com" class="gmail_msg" target="_blank">lousimons@gmail.com</a>></span> wrote:<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">I have been trying to learn PyQt5 by migrating an application from Kivy to a QtQuick/Python hybrid. I'm finally starting to understand the architecture a little better (I should have read the C++ docs sooner), but I've been running into a little weirdness. In the repository at <a href="https://github.com/superlou/snowman-qt-client" class="gmail_msg" target="_blank">https://github.com/superlou/snowman-qt-client</a>, my root QML file is app.qml, which requires the following imports to use my custom registered types:<br class="gmail_msg"><br class="gmail_msg">import Snowman 1.0<br class="gmail_msg"> import "components"<br class="gmail_msg"><br class="gmail_msg">I've been having a hard time finding examples of QML projects beyond single-file examples, but since my components are in the "components" directory, it didn't seem too strange to need to explicitly tell QML where the components in the Snowman namespace were. However, if I leave off the explicit imports in MainBus.qml and MainBusButton.qml, I get lots of errors about undefined types and recursive definitions. This seems to be resolved by using something like the following:<br class="gmail_msg"><br class="gmail_msg">import Snowman 1.0<br class="gmail_msg"> import "."<br class="gmail_msg"><br class="gmail_msg">I haven't found any examples where 'import "."' has been required, and my understanding was that QML should look in the same directory for siblings automatically. The application seems to operate normally with the import scheme shown above, but this smells funny, and I wanted to make sure I'm understanding the proper way to structure a large project before I bake an anti-patten into the code. Is there a better way to handle this?<br class="gmail_msg"><br class="gmail_msg">Thank you,<br class="gmail_msg">Louis<br class="gmail_msg"></div>
<br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="gmail_msg">
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" class="gmail_msg" target="_blank">PyQt@riverbankcomputing.com</a><br class="gmail_msg">
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" class="gmail_msg" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div>
</blockquote></div>