<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
MainWindow

The main window and system tray for the commotion_client pyqt GUI.

Key componenets handled within:
 * exiting/hiding the application
 * Creating the main window and systemTray icon.

"""
#Standard Library Imports
import logging

#PyQt imports
from PyQt4 import QtCore
from PyQt4 import QtGui

#Commotion Client Imports
from assets import assets
#from GUI.MenuBar import MenuBar

class MainWindow(QtGui.QMainWindow):
    """
    The central widget for the commotion client. This widget initalizes all other sub-widgets and extensions as well as defines the paramiters of the main GUI container.
    """

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.dirty = False #The variable to keep track of state for tracking if the gui needs any clean up.
        #set function logger
        self.log = logging.getLogger("commotion_client."+__name__) #TODO commotion_client is still being called directly from one level up so it must be hard coded as a sub-logger if called from the command line.

        #Default Paramiters #TODO to be replaced with paramiters saved between instances later

        #set main menu to not close application on exit events
        self.exitOnClose = False

        #self.menuBar = MenuBar(self)
        
        #Create tray and connect to its exit event to allow application to close.
        self.tray = trayIcon(self)
        self.connect(self.tray.exit, QtCore.SIGNAL("triggered()"), self.exitEvent)
        self.connect(self.tray, QtCore.SIGNAL("showMainWindow"), self.bringFront)
<commit_msg>Added a dock window to the main window to hold the menu bar<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
MainWindow

The main window and system tray for the commotion_client pyqt GUI.

Key componenets handled within:
 * exiting/hiding the application
 * Creating the main window and systemTray icon.

"""
#Standard Library Imports
import logging

#PyQt imports
from PyQt4 import QtCore
from PyQt4 import QtGui

#Commotion Client Imports
from assets import assets
from GUI.MenuBar import MenuBar

class MainWindow(QtGui.QMainWindow):
    """
    The central widget for the commotion client. This widget initalizes all other sub-widgets and extensions as well as defines the paramiters of the main GUI container.
    """

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.dirty = False #The variable to keep track of state for tracking if the gui needs any clean up.
        #set function logger
        self.log = logging.getLogger("commotion_client."+__name__) #TODO commotion_client is still being called directly from one level up so it must be hard coded as a sub-logger if called from the command line.

        #Default Paramiters #TODO to be replaced with paramiters saved between instances later

        #set main menu to not close application on exit events
        self.exitOnClose = False
                
        #Set up menu bar.
        self.menuBar = MenuBar(self)

        #Create dock for menu-bar TEST
        self.menuDock = QtGui.QDockWidget(self)
        self.menuDock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
        self.menuDock.setObjectName("MenuBarDock")
        self.menuDock.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea)
        self.menuDock.setWidget(self.menuBar)
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.menuDock)


        #set up viewport
        #self.viewport = Viewport(self)
        
        #Create slot to monitor when menu-bar wants the main window to change the main-viewport
        self.connect(self.menuBar, QtCore.SIGNAL("viewportRequested()"), self.changeViewport)
        
        #Create tray
        self.tray = trayIcon(self)
        #connect to tray events for closing application and showing main window.
        self.connect(self.tray.exit, QtCore.SIGNAL("triggered()"), self.exitEvent)
        self.connect(self.tray, QtCore.SIGNAL("showMainWindow"), self.bringFront)

    def changeViewport(self, viewport):
        self.log.debug(QtCore.QCoreApplication.translate("logs", "Request to change viewport received."))
        self.viewport.setViewport(viewport)

{'fraction_non_alphanumeric': 0.07470725995316159, 'fraction_numerical': 0.001873536299765808, 'mean_word_length': 3.305443548387097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2212140', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1181, 'n_words': 431}