Skip to main content
Bounty Awarded with 50 reputation awarded by CommunityBot
added 742 characters in body
Source Link
Morwenn
  • 20.2k
  • 3
  • 69
  • 132

From your answer to my comment, I will drop the intended Python 3 paragraph (even though there are some goodies you may like in the most recent versions, such as the new pathlib that supersedes the old os.path module) and go straight to the main point:

Qt Designer is the way to go

Writing user interface code is something that nobody likes to do. You could seriously save a good amount of lines of code by designing your main UI in Qt Designer and using pyuic4 or pyside-uic to generate the boring code so that you can concentrate on the Model and Control part of the code.

Internationalization

While it may not be important, it doesn't cost more than a few self.tr() in order to tell which strings may be translated, even if you don't set up any translation for now. But if one day you want to translate everything, you will be glad not to have to reread your entire project to know which strings need to be translated. That said, many of the strings to be translated are automatically marked as such in the code generated by Qt Designer.

Consistency is the key

When reading the following piece of code:

def __init__(self, parent=None, filename = None):
    QtGui.QTreeView.__init__(self, parent=None)

Two things strike me:

  • Was your intention to forward parent to QTreeView.__init__? If so, I fear that it is not what's being done right here.

  • The way declare default values for parameter in inconsistent style-wise. I bet that it is an oversight though since most of your code seems consistent when it comes to the style. If we follow the PEP8 (I guess we should), we should drop the spaces around the = for default parameters:

      def __init__(self, parent=None, filename=None):
          QtGui.QTreeView.__init__(self, parent)
    

From your answer to my comment, I will drop the intended Python 3 paragraph (even though there are some goodies you may like in the most recent versions, such as the new pathlib that supersedes the old os.path module) and go straight to the main point:

Qt Designer is the way to go

Writing user interface code is something that nobody likes to do. You could seriously save a good amount of lines of code by designing your main UI in Qt Designer and using pyuic4 or pyside-uic to generate the boring code so that you can concentrate on the Model and Control part of the code.

Internationalization

While it may not be important, it doesn't cost more than a few self.tr() in order to tell which strings may be translated, even if you don't set up any translation for now. But if one day you want to translate everything, you will be glad not to have to reread your entire project to know which strings need to be translated. That said, many of the strings to be translated are automatically marked as such in the code generated by Qt Designer.

From your answer to my comment, I will drop the intended Python 3 paragraph (even though there are some goodies you may like in the most recent versions, such as the new pathlib that supersedes the old os.path module) and go straight to the main point:

Qt Designer is the way to go

Writing user interface code is something that nobody likes to do. You could seriously save a good amount of lines of code by designing your main UI in Qt Designer and using pyuic4 or pyside-uic to generate the boring code so that you can concentrate on the Model and Control part of the code.

Internationalization

While it may not be important, it doesn't cost more than a few self.tr() in order to tell which strings may be translated, even if you don't set up any translation for now. But if one day you want to translate everything, you will be glad not to have to reread your entire project to know which strings need to be translated. That said, many of the strings to be translated are automatically marked as such in the code generated by Qt Designer.

Consistency is the key

When reading the following piece of code:

def __init__(self, parent=None, filename = None):
    QtGui.QTreeView.__init__(self, parent=None)

Two things strike me:

  • Was your intention to forward parent to QTreeView.__init__? If so, I fear that it is not what's being done right here.

  • The way declare default values for parameter in inconsistent style-wise. I bet that it is an oversight though since most of your code seems consistent when it comes to the style. If we follow the PEP8 (I guess we should), we should drop the spaces around the = for default parameters:

      def __init__(self, parent=None, filename=None):
          QtGui.QTreeView.__init__(self, parent)
    
Source Link
Morwenn
  • 20.2k
  • 3
  • 69
  • 132

From your answer to my comment, I will drop the intended Python 3 paragraph (even though there are some goodies you may like in the most recent versions, such as the new pathlib that supersedes the old os.path module) and go straight to the main point:

Qt Designer is the way to go

Writing user interface code is something that nobody likes to do. You could seriously save a good amount of lines of code by designing your main UI in Qt Designer and using pyuic4 or pyside-uic to generate the boring code so that you can concentrate on the Model and Control part of the code.

Internationalization

While it may not be important, it doesn't cost more than a few self.tr() in order to tell which strings may be translated, even if you don't set up any translation for now. But if one day you want to translate everything, you will be glad not to have to reread your entire project to know which strings need to be translated. That said, many of the strings to be translated are automatically marked as such in the code generated by Qt Designer.