Example #1
0
 def drawControl(self, element, opt, p, widget=None):
     if element == data.QStyle.CE_MenuItem:
         # Store the item's pixmap
         pixmap = opt.icon.pixmap(self.scale_constant)
         # Disable the icon from being drawn automatically
         opt.icon = data.QIcon()
         # Adjust the font
         opt.font = self.custom_font
         # Setup and draw everything except the icon
         opt.maxIconWidth = self.scale_constant
         self._style.drawControl(element, opt, p, widget)
         if pixmap.isNull() == False:
             # Manually draw the icon
             alignment = data.Qt.AlignLeft
             self.drawItemPixmap(p, opt.rect, alignment, pixmap)
     elif element == data.QStyle.CE_MenuBarItem:
         text = opt.text.replace("&", "")
         opt.text = ""
         self._style.drawControl(element, opt, p, widget)
         alignment = data.Qt.AlignCenter
         p.setFont(self.custom_font)
         self.drawItemText(p, opt.rect, alignment, opt.palette, opt.state,
                           text, data.QPalette.NoRole)
     else:
         self._style.drawControl(element, opt, p, widget)
Example #2
0
    def __init__(self, parent):
        """Initialization routine"""
        #Initialize superclass, from which the current class is inherited, THIS MUST BE DONE SO THAT THE SUPERCLASS EXECUTES ITS __init__ !!!!!!
        super().__init__()

        #Initialize the log window
        self.setWindowTitle("LOGGING WINDOW")
        self.resize(500, 300)
        self.setWindowFlags(data.Qt.WindowStaysOnTopHint)

        #Initialize the display box
        self.displaybox = MessageLogger.MessageTextBox(self)
        self.displaybox.setReadOnly(True)
        #Make displaybox click/doubleclick event also fire the log window click/doubleclick method
        self.displaybox.mousePressEvent = self._event_mousepress
        self.displaybox.mouseDoubleClickEvent = self._event_mouse_doubleclick
        self.keyPressEvent = self._keypress

        #Initialize layout
        self.layout = data.QGridLayout()
        self.layout.addWidget(self.displaybox)
        self.setLayout(self.layout)

        self.append_message("Ex.Co. debug log window loaded")
        self.append_message("LOGGING Mode is enabled")
        self._parent = parent

        #Set the log window icon
        if os.path.isfile(data.application_icon) == True:
            self.setWindowIcon(data.QIcon(data.application_icon))
Example #3
0
 def __init__(self, text, dialog_type=None, parent=None):
     super().__init__(parent)
     # Make the dialog stay on top
     self.setWindowFlags(data.Qt.WindowStaysOnTopHint)
     # Set the dialog icon and title
     self.setWindowIcon(data.QIcon(data.application_icon))
     self.setWindowTitle(dialog_type.title())
     self.init_layout(text, dialog_type)
Example #4
0
 def __init__(self, parent, app_dir=""):
     """Initialization routine"""
     #Initialize superclass, from which the current class is inherited,
     #THIS MUST BE DONE SO THAT THE SUPERCLASS EXECUTES ITS __init__ !!!!!!
     super().__init__()
     #Setup the window
     self.setWindowTitle("About Ex.Co.")
     self.setWindowFlags(data.Qt.WindowStaysOnTopHint)
     #Setup the picture
     exco_picture = data.QPixmap(data.about_image)
     self.picture = data.QLabel(self)
     self.picture.setPixmap(exco_picture)
     self.picture.setGeometry(self.frameGeometry())
     self.picture.setScaledContents(True)
     #Assign events
     self.picture.mousePressEvent = self._close
     self.picture.mouseDoubleClickEvent = self._close
     #Initialize layout
     self.layout = data.QGridLayout()
     self.layout.addWidget(self.picture)
     self.layout.setSpacing(0)
     self.layout.setContentsMargins(data.QMargins(0, 0, 0, 0))
     self.setLayout(self.layout)
     #Set the log window icon
     if os.path.isfile(data.application_icon) == True:
         self.setWindowIcon(data.QIcon(data.application_icon))
     #Save the info window geometry, the values were gotten by showing a dialog with the label containing
     #the ExCo info image with the size set to (50, 50), so it would automatically resize to the label image size
     my_width = 610
     my_height = 620
     #Set the info window position
     parent_left = parent.geometry().left()
     parent_top = parent.geometry().top()
     parent_width = parent.geometry().width()
     parent_height = parent.geometry().height()
     my_left = parent_left + (parent_width / 2) - (my_width / 2)
     my_top = parent_top + (parent_height / 2) - (my_height / 2)
     self.setGeometry(
         functions.create_rect(my_left, my_top, my_width, my_height))
     self.setFixedSize(my_width, my_height)