def __init__(self, parent): gtk.StatusIcon.__init__(self) menu = ''' <ui> <menubar name="Menubar"> <menu action="Menu"> <separator/> <menuitem action="About"/> <separator/> <menuitem action="Quit"/> </menu> </menubar> </ui> ''' actions = [ ('Menu', None, 'Menu'), ('About', gtk.STOCK_ABOUT, 'About', None, 'About', self.on_about), ('Quit', gtk.STOCK_QUIT, 'Quit', None, 'Quit', self.on_quit) ] ag = gtk.ActionGroup('Actions') ag.add_actions(actions) self.manager = gtk.UIManager() self.manager.insert_action_group(ag, 0) self.manager.add_ui_from_string(menu) self.menu = self.manager.get_widget('/Menubar/Menu/About').props.parent iconFile = fileTools.findFileInProduct('gf-16x16.png') self.set_from_file(iconFile) self.set_tooltip('Console window for python applications') self.set_visible(True) #self.connect('activate', self.on_activate) self.connect('activate', self.on_popup_menu) self.connect('popup-menu', self.on_popup_menu) self.parent = parent self.actionTextMapping = {}
def startScriptRunnerApp(self): self.task_to_menu_item_dict = {} self.app_name_to_task_dict = {} w = gtk.Window() self.window = w w.set_size_request(100, 100) w.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY)#Hide from the taskbar. w.connect('destroy', lambda w: gtk.main_quit()) self.startDragMove() self.setDropTarget() self.icon = gtkTaskbarIconForConsole.MyStatusIcon(self) w.set_keep_above(True) w.set_opacity(0.5) w.set_decorated(False)#Disable window frame board, work in company machine w.show_all() self.start_basic_service() for i in self.initialApps: fullP = fileTools.findFileInProduct(i) if fullP is None: fullP = fileTools.findAppInProduct(i) if fullP is None: print i, 'not found ---- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' continue #print '-----------------------------',fullP self.create_console_wnd_for_app([fullP])
def __init__(self, parent): gladefile = "consoleWnd.glade" fullPath = fileTools.findFileInProduct(gladefile) # Loads the UI from GtkBuilder XML file self.builder.add_from_file(fullPath) # Lets extract a reference to window object to use later self.window = self.builder.get_object(self.windowname) self.parent = parent #self.minimized = False window = self.window window.set_resizable(True) window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY) #window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NORMAL) #window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) #window.connect("destroy", self.on_quit_clicked) #window.connect('window-state-event', self.new_window_state) window.set_title("Python console log window") window.set_border_width(1) dic = { "destory_cb":self.on_quit_clicked, "minimize_clicked_cb":self.min, 'topmost_toggled_cb':self.topMost } self.builder.connect_signals (dic) self.textview = self.builder.get_object(self.textWndName) self.topMostFlag = True self.topMost(None) self.console_output_collector = ConsoleOutputCollector() #window.show() self.isMinimized = True self.window.hide()
def start_basic_app(self, app_name): full_path = fileTools.findFileInProduct(app_name) if full_path is None: full_path = fileTools.findAppInProduct(app_name) if full_path is None: print app_name, 'not found ---- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' return None return self.create_console_wnd_for_app([full_path])
def startAppRunnerService(target = None): ######################## #Start dbus deamon first ######################## dbusAppName = "dbus-daemon.exe" dbusAppPath = fileTools.findFileInProduct(dbusAppName) processObj = None if not (dbusAppPath is None): print 'launching dbus daemon' processObj = subprocess.Popen([dbusAppPath, "--config-file=session.conf"], creationflags = CREATE_NO_WINDOW) ######################## threads_init() dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() name = dbus.service.BusName("com.wwjufsdatabase.appStarterService", session_bus) mainloop = gobject.MainLoop() ############################ #Start app starter service ############################ #Set message target so start app message can be sent to the GTK desktop application. And the GTK desktop #application will start the real application and add entry to task bar icon menu. object = appStarter(session_bus, '/appStarter') object.setTarget(target) #Set the mainloop obj so app starter service provides object.setLoop(mainloop) ############################ #Start task manager service ############################ taskManagerObj = taskManager.taskManagerService(session_bus, '/taskManager') #Only appStarter need to take control on stop the bus message loop #taskManagerObj.setLoop(mainloop) ############################ #Start task manager service ############################ #dirMon = dirMonitorService.dirMonitorService(session_bus, '/dirMonitor') ############################ #Start main message loop for DBus services ############################ mainloop.run() ''' if not (processObj is None): print 'processing:', processObj.pid, int(processObj._handle) processManager.killChildProcessTree(processObj.pid) win32api.TerminateProcess(int(processObj._handle), -1) ''' print 'quitting mainloop.run()'
def startScriptRunnerApp(self): self.tL = {} self.mD = {} w = gtk.Window() self.window = w w.set_size_request(100, 100) w.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY)#Hide from the taskbar. w.connect('destroy', lambda w: gtk.main_quit()) self.startDragMove() self.setDropTarget() self.icon = gtkTaskbarIconForConsole.MyStatusIcon(self) w.set_keep_above(True) w.set_opacity(0.5) w.set_decorated(False)#Disable window frame board, work in company machine w.show_all() for i in self.initialApps: fullP = fileTools.findFileInProduct(i) #print '-----------------------------',fullP self.startApp(fullP)
def __init__(self): super(ApplicationList, self).__init__() ui_full_path = fileTools.findFileInProduct('app_list.ui') self.ui = uic.loadUi(ui_full_path, self) self.model = QStandardItemModel() ''' item = QStandardItem('Hello world') item1 = QStandardItem('Hello world1') item.setCheckState(Qt.Checked) item.setCheckable(True) item1.setCheckState(Qt.Checked) item1.setCheckable(True) self.model.appendRow(item) self.model.appendRow(item1) ''' self.listView.setModel(self.model) ''' self.connect(self.listView.selectionModel(), QtCore.SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.store_current_selection) ''' self.show() self.listView.clicked.connect(self.item_clicked)
def __init__(self): self.builder = gtk.Builder() gladefile = "TagDialog.glade" fullPath = fileTools.findFileInProduct(gladefile) # Loads the UI from GtkBuilder XML file self.builder.add_from_file(fullPath) # Lets extract a reference to window object to use later #self.window = self.builder.get_object(self.windowname) #self.minimized = False #window = self.window #window.set_resizable(True) #window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY) #self.builder.add_from_file("tagDialog.glade") self.window1 = self.builder.get_object("dialog1") #self.liststore1 = self.builder.get_object("liststore1") #self.liststore1.append(["good"]) self.list = self.builder.get_object("treeview1") self.liststore = gtk.ListStore(int, str) self.liststore.append([False,'red']) self.liststore.append([True,'green']) #iter = liststore.insert(1, (2,'blue',colormap.alloc_color('blue')) ) #iter = liststore.insert_after(iter, [3,'yellow',colormap.alloc_color('blue')]) ################################### # Add checkbox ################################### # From http://stackoverflow.com/questions/5707495/problem-with-checkboxes-in-a-pygtk-treeview # And ref: http://python-gtk-3-tutorial.readthedocs.org/en/latest/cellrenderers.html cell = gtk.CellRendererToggle() #cell.connect("toggled", on_toggle, model) col = gtk.TreeViewColumn("select", cell, active=0) cell.connect("toggled", self.on_cell_toggled) ################################### # Add title of column ################################### #column = gtk.TreeViewColumn("index") column_file_path = gtk.TreeViewColumn("file_path") #self.list.append_column(column) self.list.append_column(col) self.list.append_column(column_file_path) ################################### # Display list store data ################################### # From http://learngtk.org/pygtk-tutorial/liststore.html ''' cell = gtk.CellRendererText() col.pack_start(cell, False) col.add_attribute(cell, "text", 0) ''' cell_file_path = gtk.CellRendererText() column_file_path.pack_start(cell_file_path, False) column_file_path.add_attribute(cell_file_path, "text", 1) self.list.set_model(self.liststore) #self.window1.show() dic = { "on_ok_button_clicked":self.on_ok_button_clicked, "on_cancel_button_clicked": self.on_cancel_button_clicked, } self.builder.connect_signals(dic)
def __init__(self, parent): gladefile = "consoleWnd.glade" fullPath = fileTools.findFileInProduct(gladefile) # Loads the UI from GtkBuilder XML file self.builder.add_from_file(fullPath) # Lets extract a reference to window object to use later self.window = self.builder.get_object(self.windowname) self.parent = parent #self.minimized = False window = self.window window.set_resizable(True) window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY) #window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NORMAL) #window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) ''' Gdk::WINDOW_TYPE_HINT_NORMAL, Gdk::WINDOW_TYPE_HINT_DIALOG, Gdk::WINDOW_TYPE_HINT_MENU, Gdk::WINDOW_TYPE_HINT_TOOLBAR, Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN, Gdk::WINDOW_TYPE_HINT_UTILITY, Gdk::WINDOW_TYPE_HINT_DOCK, Gdk::WINDOW_TYPE_HINT_DESKTOP, Gdk::WINDOW_TYPE_HINT_DROPDOWN_MENU, Gdk::WINDOW_TYPE_HINT_POPUP_MENU, Gdk::WINDOW_TYPE_HINT_TOOLTIP, Gdk::WINDOW_TYPE_HINT_NOTIFICATION, Gdk::WINDOW_TYPE_HINT_COMBO, ''' #window.connect("destroy", self.close_application) #window.connect('window-state-event', self.new_window_state) window.set_title("Python console log window") window.set_border_width(1) dic = { "destory_cb":self.close_application, "minimize_clicked_cb":self.min, 'topmost_toggled_cb':self.topMost } self.builder.connect_signals (dic) self.textview = self.builder.get_object(self.textWndName) self.topMostFlag = True self.topMost(None) ''' box1 = gtk.VBox(False, 0) window.add(box1) box1.show() box2 = gtk.VBox(False, 10) box2.set_border_width(2) box1.pack_start(box2, True, True, 0) box2.show() sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) textview = gtk.TextView() self.textview = textview textbuffer = textview.get_buffer() sw.add(textview) sw.show() textview.show() box2.pack_start(sw) #self.icon = gtkTaskbarIconForConsole.MyStatusIcon(self) button2 = gtk.Button("minimize") button2.connect("clicked", self.min) box2.pack_start(button2, False, True, 0) button2.set_flags(gtk.CAN_DEFAULT) button2.grab_default() button2.show() ''' self.wC = wndConsole() #window.show() self.isMinimized = True self.window.hide()
def create_taskbar_icon_app(self): self.w = QtGui.QWidget() icon_full_path = fileTools.findFileInProduct("gf-16x16.png") self.trayIcon = List2SystemTray(QtGui.QIcon(icon_full_path), self.w) #self.trayIcon["Example"] = exampleAction return self.trayIcon