コード例 #1
0
ファイル: __init__.py プロジェクト: pombredanne/MITH_Session
 def event(self, event):
     if isinstance(event, QtGui.QFileOpenEvent):
         fname = str(event.file())
         if fname and fname != 'iep':
             sys.argv[1:] = []
             sys.argv.append(fname)
             res = commandline.handle_cmd_args()
             if not commandline.is_our_server_running():
                 print(res)
                 sys.exit()
     return QtGui.QApplication.event(self, event) 
コード例 #2
0
ファイル: main.py プロジェクト: pombredanne/MITH_Session
 def __init__(self, parent=None, locale=None):
     QtGui.QMainWindow.__init__(self, parent)
     
     self._closeflag = 0  # Used during closing/restarting
     
     # Init window title and application icon
     # Set title to something nice. On Ubuntu 12.10 this text is what
     # is being shown at the fancy title bar (since it's not properly 
     # updated)
     self.setMainTitle()
     loadAppIcons()
     self.setWindowIcon(iep.icon)
     
     # Restore window geometry before drawing for the first time,
     # such that the window is in the right place
     self.resize(800, 600) # default size
     self.restoreGeometry()
     
     # Show splash screen (we need to set our color too)
     w = SplashWidget(self, distro=iep.distro_name)
     self.setCentralWidget(w)
     self.setStyleSheet("QMainWindow { background-color: #268bd2;}")
     
     # Show empty window and disable updates for a while
     self.show()
     self.paintNow()
     self.setUpdatesEnabled(False)
     
     # Determine timeout for showing splash screen
     splash_timeout = time.time() + 1.0
     
     # Set locale of main widget, so that qt strings are translated
     # in the right way
     if locale:
         self.setLocale(locale)
     
     # Store myself
     iep.main = self
     
     # Init dockwidget settings
     self.setTabPosition(QtCore.Qt.AllDockWidgetAreas,QtGui.QTabWidget.South)
     self.setDockOptions(
             QtGui.QMainWindow.AllowNestedDocks
         |  QtGui.QMainWindow.AllowTabbedDocks
         #|  QtGui.QMainWindow.AnimatedDocks
         )
     
     # Set window atrributes
     self.setAttribute(QtCore.Qt.WA_AlwaysShowToolTips, True)
     
     # Load icons and fonts
     loadIcons()
     loadFonts()
     
     # Set qt style and test success
     self.setQtStyle(None) # None means init!
     
     # Hold the splash screen if needed
     while time.time() < splash_timeout:
         QtGui.qApp.flush()
         QtGui.qApp.processEvents()
         time.sleep(0.05)
     
     # Populate the window (imports more code)
     self._populate()
     
     # Revert to normal background, and enable updates
     self.setStyleSheet('')
     self.setUpdatesEnabled(True)
     
     # Restore window state, force updating, and restore again
     self.restoreState()
     self.paintNow()
     self.restoreState()
     
     # Load basic tools if new user
     if iep.config.state.newUser and not iep.config.state.loadedTools:
         iep.toolManager.loadTool('iepsourcestructure')
         iep.toolManager.loadTool('iepfilebrowser')
     
     # Present user with wizard if he/she is new.
     if iep.config.state.newUser:
         from iep.util.iepwizard import IEPWizard
         w = IEPWizard(self)
         w.show() # Use show() instead of exec_() so the user can interact with IEP
     
     # Create new shell config if there is None
     if not iep.config.shellConfigs2:
         from iep.iepcore.kernelbroker import KernelInfo
         iep.config.shellConfigs2.append( KernelInfo() )
     
     # Focus on editor
     e = iep.editors.getCurrentEditor()
     if e is not None:
         e.setFocus()
     
     # Handle any actions
     commandline.handle_cmd_args()
コード例 #3
0
ファイル: __init__.py プロジェクト: pombredanne/MITH_Session
    raise RuntimeError('IEP requires Pyzolib 0.2.5 or higher.')
elif pyzolib.__version__ < '0.2.9':
    print('Warning: pyzolib 0.2.9 is recommended to run IEP.')

# Import yoton as an absolute package
from iep import yotonloader

# If there already is an instance of IEP, and the user is trying an 
# IEP command, we should send the command to the other process and quit.
# We do this here, were we have not yet loaded Qt, so we are very light.
from iep.iepcore import commandline
if commandline.is_our_server_running():
    print('Started our command server')
else:
    # Handle command line args now
    res = commandline.handle_cmd_args()
    if res:
        print(res)
        sys.exit()
    else:
        # No args, proceed with starting up
        print('Our command server is *not* running')


from pyzolib import ssdf, paths
from pyzolib.qt import QtCore, QtGui

# Import language/translation tools
from iep.util.locale import translate, setLanguage

# Set environ to let kernel know some stats about us