def main(args): """ args is the list of arguments passed """ # arguments handling parser = argparse.ArgumentParser(prog="odemis-cli", description=odemis.__fullname__) parser.add_argument('--version', dest="version", action='store_true', help="show program's version number and exit") parser.add_argument('--standalone', dest="standalone", action='store_true', default=False, help="just display simple interface, " "without trying to connect to the back-end") parser.add_argument("--log-level", dest="loglev", metavar="<level>", type=int, default=0, help="set verbosity level (0-2, default = 0)") options = parser.parse_args(args[1:]) # Cannot use the internal feature, because it doesn't support multiline if options.version: print (odemis.__fullname__ + " " + odemis.__version__ + "\n" + odemis.__copyright__ + "\n" + "Licensed under the " + odemis.__license__) return 0 # Set up logging before everything else if options.loglev < 0: parser.error("log-level must be positive.") loglev_names = [logging.WARNING, logging.INFO, logging.DEBUG] loglev = loglev_names[min(len(loglev_names) - 1, options.loglev)] log.init_logger(loglev) if 'linux' in sys.platform: # Set WM_CLASS on linux, needed to get connected to the right icon. # wxPython doesn't do it, see http://trac.wxwidgets.org/ticket/12778 try: # Also possible via Xlib, but more complicated import gtk # without it, it will crash cf https://groups.google.com/forum/#!topic/wxpython-users/KO_hmLxeDKA gtk.remove_log_handlers() # Must be done before the first window is displayed name = "Odemis" if options.standalone: name += "-standalone" gtk.gdk.set_program_class(name) except Exception: logging.info("Failed to set WM_CLASS") # Create application app = OdemisGUIApp(standalone=options.standalone) # Change exception hook so unexpected exception # get caught by the logger backup_excepthook, sys.excepthook = sys.excepthook, app.excepthook # Start the application app.MainLoop() app.Destroy() sys.excepthook = backup_excepthook
def __init__(self, args): gtk.gdk.threads_init() gtk.remove_log_handlers() gtk.Window.__init__(self) self.fullscreen() self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK) self.set_keep_below(True) self.set_decorated(False) self.set_skip_taskbar_hint(True) self.set_skip_pager_hint(True) self.stick() self.screen = self.get_screen() self.rgba = self.screen.get_rgba_colormap() self.set_colormap(self.rgba) self.set_app_paintable(True) self.connect("expose-event", self.transparent_expose) self.view = webkit.WebView() self.view.set_transparent(True); self.add(self.view) settings = webkit.WebSettings() settings.set_property("enable-plugins", False) settings.set_property('enable-file-access-from-file-uris', 1) settings.set_property('enable-default-context-menu', False) self.view.set_settings(settings) self.view.connect("console-message", self.console) self.view.connect('load-finished', self._finished_loading) self.view.connect('title-changed', self.title_changed) self.view.show_all() self.show_all() self.fullscreen() self.view.open(self.url) pass
def main(args=None): if args is None: args = sys.argv[1:] import gtk gtk.remove_log_handlers() cairisApp = IRISApp() cairisApp.MainLoop()
def initPrinting(self): ''' Prepare for printing. ''' # On Jolicloud, printing crashes unless we do this: if '__WXGTK__' == wx.Platform: try: import gtk gtk.remove_log_handlers() except ImportError: pass
def __init__(self, args): # aa = capturePic('mimo') if len(args) > 1: self.test = args[1] == "test" else: self.test = False self.log = Log("/var/log/gdm/gdm-webkit-greeter.log", "%(asctime)-15s %(message)s", self.test) self.args = args self.log.i("starting gdm-webkit-greeter") gtk.gdk.threads_init() gtk.remove_log_handlers() gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_decorated(False) self.set_skip_taskbar_hint(True) self.set_skip_pager_hint(True) self.stick() self.screen = self.get_screen() self.rgba = self.screen.get_rgba_colormap() self.set_colormap(self.rgba) self.set_app_paintable(True) self.connect("expose-event", self.transparent_expose) self.view = webkit.WebView() self.view.set_transparent(True) self.add(self.view) settings = webkit.WebSettings() settings.set_property("enable-plugins", False) settings.set_property("enable-file-access-from-file-uris", 1) settings.set_property("enable-default-context-menu", False) self.view.set_settings(settings) if not (self.test): self.connect("delete-event", self.no_delete) else: self.connect("delete-event", self.exit) self.view.connect("console-message", self.console) self.view.connect("load-finished", self._finished_loading) self.view.connect("title-changed", self.title_changed) self.view.show_all() self.show_all() self.fullscreen() self.view.open(self.url) self.log.i("interface created") pass
# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import os import sys def main(args=None): if args is None: args = sys.argv[1:] cairisApp = IRISApp() cairisApp.MainLoop() if __name__ == '__main__': try: import gtk gtk.remove_log_handlers() from cairis.gui.IRISApp import IRISApp from cairis.core.ARM import ARMException main() except ImportError, e: print "Fatal CAIRIS error: " + str(e) sys.exit(-1) except ARMException, e: print "Fatal CAIRIS error: " + str(e) sys.exit(-1)
# specific language governing permissions and limitations # under the License. import os import sys from cairis.core.ARM import * __author__ = 'Shamal Faily' def main(args=None): if args is None: args = sys.argv[1:] cairisApp = IRISApp() cairisApp.MainLoop() if __name__ == '__main__': try: import gtk gtk.remove_log_handlers() from cairis.gui.IRISApp import IRISApp from cairis.core.ARM import ARMException main() except ImportError, e: print "Fatal CAIRIS error: " + str(e) sys.exit(-1) except ARMException, e: print "Fatal CAIRIS error: " + str(e) sys.exit(-1)