Changeset 27:d95d48685969


Ignore:
Timestamp:
02/25/12 10:14:12 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Created icons, reorganized sources and made the Windows installer work

Files:
4 added
3 edited
12 moved

Legend:

Unmodified
Added
Removed
  • MANIFEST.in

    r20 r27  
    22include makeinst.bat
    33include license.txt
     4include runmlx.py
  • mlx.nsi

    r20 r27  
    3333;Interface Settings
    3434
    35   ;!define MUI_ICON "cflib\cfgui.ico"
    36   ;!define MUI_UNICON "cflib\cfgui_uninst.ico"
     35  !define MUI_ICON "src/mlx/logo.ico"
     36  !define MUI_UNICON "src/mlx/logo_uninst.ico"
    3737  !define MUI_ABORTWARNING
    3838
  • runmlx.py

    r20 r27  
    22
    33if __name__ == "__main__":
    4     import mlx
    5     mlx.main()
     4    import mlx.mlx
     5    mlx.mlx.main()
  • setup.py

    r20 r27  
    88sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), "src"))
    99
    10 import const
     10import mlx.const
    1111
    1212data_files = []
    1313if os.name=="nt":
    1414    import py2exe
     15
     16    data_files.append(("", ["src/mlx/logo.ico"]))
    1517
    1618    msvcrDir = os.environ["MSVCRDIR"] if "MSVCRDIR" in os.environ else None
     
    2729       
    2830    with open("mlx-common.nsh", "wt") as f:
    29             print >>f, '!define MLX_VERSION "%s"' % (const.VERSION)
     31            print >>f, '!define MLX_VERSION "%s"' % (mlx.const.VERSION)
    3032            f.close()
    3133
     
    3739
    3840setup(name = "mlx",
    39       version = const.VERSION,
     41      version = mlx.const.VERSION,
    4042      description = "MAVA Logger X",
    4143      long_description = long_description,
     
    4446      url = "http://mlx.varadiistvan.hu",
    4547      package_dir = { "" : "src" },
    46       packages = [""],
     48      packages = ["mlx"],
     49      package_data = { "mlx" : ["logo.ico", "logo_uninst.ico"] },
    4750      requires = ["pyuipc"],
    48       windows = [{ "script" : "src/runmlx.py" }],
     51      windows = [{ "script" : "runmlx.py",
     52                   "icon_resources" : [(1, "src/mlx/logo.ico")]}],
    4953      options = { "py2exe" : { "includes": "gio, pango, atk, pangocairo"} },
    5054      data_files = data_files,
  • src/mlx/mlx.py

    r26 r27  
    1212import time
    1313
     14appIndicator = False
     15
    1416if os.name=="nt" or "FORCE_PYGTK" in os.environ:
    1517    print "Using PyGTK"
     
    1820    import gtk
    1921    import gobject
     22    try:
     23        import appindicator
     24        appIndicator = True
     25    except Exception, e:
     26        pass
    2027else:
    2128    print "Using PyGObject"
     
    2330    from gi.repository import Gtk as gtk
    2431    from gi.repository import GObject as gobject
     32    from gi.repository import AppIndicator3 as appindicator
     33    appIndicator = True
    2534
    2635import cairo
     
    5665        win = gtk.Window()
    5766        win.set_title("MAVA Logger X " + const.VERSION)
     67        win.set_icon_from_file("logo.ico")
    5868        win.connect("delete-event", gtk.main_quit)
    5969
     
    586596        self._logView.scroll_mark_onscreen(buffer.get_insert())
    587597
     598class TrackerStatusIcon(gtk.StatusIcon):
     599        def __init__(self):
     600                gtk.StatusIcon.__init__(self)
     601                menu = '''
     602                        <ui>
     603                         <menubar name="Menubar">
     604                          <menu action="Menu">
     605                           <menuitem action="Search"/>
     606                           <menuitem action="Preferences"/>
     607                           <separator/>
     608                           <menuitem action="About"/>
     609                          </menu>
     610                         </menubar>
     611                        </ui>
     612                '''
     613                actions = [
     614                        ('Menu',  None, 'Menu'),
     615                        ('Search', None, '_Search...', None, 'Search files with MetaTracker', self.on_activate),
     616                        ('Preferences', gtk.STOCK_PREFERENCES, '_Preferences...', None, 'Change MetaTracker preferences', self.on_preferences),
     617                        ('About', gtk.STOCK_ABOUT, '_About...', None, 'About MetaTracker', self.on_about)]
     618                ag = gtk.ActionGroup('Actions')
     619                ag.add_actions(actions)
     620                self.manager = gtk.UIManager()
     621                self.manager.insert_action_group(ag, 0)
     622                self.manager.add_ui_from_string(menu)
     623                self.menu = self.manager.get_widget('/Menubar/Menu/About').props.parent
     624                search = self.manager.get_widget('/Menubar/Menu/Search')
     625                search.get_children()[0].set_markup('<b>_Search...</b>')
     626                search.get_children()[0].set_use_underline(True)
     627                search.get_children()[0].set_use_markup(True)
     628                #search.get_children()[1].set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU)
     629                self.set_from_stock(gtk.STOCK_FIND)
     630                self.set_tooltip('Tracker Desktop Search')
     631                self.set_visible(True)
     632                self.connect('activate', self.on_activate)
     633                self.connect('popup-menu', self.on_popup_menu)
     634
     635        def on_activate(self, data):
     636                os.spawnlpe(os.P_NOWAIT, 'tracker-search-tool', os.environ)
     637
     638        def on_popup_menu(self, status, button, time):
     639                self.menu.popup(None, None, None, button, time)
     640
     641        def on_preferences(self, data):
     642                print 'preferences'
     643
     644        def on_about(self, data):
     645                dialog = gtk.AboutDialog()
     646                dialog.set_name('Tracker')
     647                dialog.set_version('0.5.0')
     648                dialog.set_comments('A desktop indexing and search tool')
     649                dialog.set_website('www.freedesktop.org/Tracker')
     650                dialog.run()
     651                dialog.destroy()
     652
    588653def main():
    589654    """The main operation of the program."""
    590655    gobject.threads_init()
     656
     657    # menu = gtk.Menu() 
     658    # item = gtk.MenuItem() 
     659    # item.set_label("Menu Item") 
     660    # item.show() 
     661    # menu.append(item) 
     662
     663    # menu.show() 
     664
     665    # if appIndicator:
     666    #     if pygobject:
     667    #         ind = appindicator.Indicator.new ("mava-logger-x",
     668    #                                           "/home/vi/munka/repules/mlx/src/logo.ico",
     669    #                                           #"indicator-messages",
     670    #                                           appindicator.IndicatorCategory.APPLICATION_STATUS)
     671    #         ind.set_status (appindicator.IndicatorStatus.ACTIVE)
     672    #     else:
     673    #         ind = appindicator.Indicator ("mava-logger-x",
     674    #                                       "/home/vi/munka/repules/mlx/src/logo.ico",
     675    #                                       appindicator.CATEGORY_APPLICATION_STATUS)
     676    #         ind.set_status (appindicator.STATUS_ACTIVE)
     677
     678    #     ind.set_menu(menu)
     679    #     #ind.set_icon("distributor-logo")
     680    # else:
     681    #     def popup_menu(status, button, time):
     682    #         menu.popup(None, None, gtk.status_icon_position_menu,
     683    #                    button, time, status)
     684    #     statusIcon = gtk.StatusIcon()
     685    #     #statusIcon.set_from_stock(gtk.STOCK_FIND)
     686    #     statusIcon.set_from_file("logo.ico")
     687    #     statusIcon.set_tooltip_markup("MAVA Logger X")
     688    #     statusIcon.set_visible(True)
     689    #     statusIcon.connect('popup-menu', popup_menu)
     690
    591691    gui = GUI()
    592692    gui.build()
    593693    gui.run()
    594              
     694
    595695if __name__ == "__main__":
    596696    main()
Note: See TracChangeset for help on using the changeset viewer.