Example #1
0
	def create(self):
		self.status_icon = gtk.StatusIcon()
		self.spring_logo_pixbuf = gtk.gdk.pixbuf_new_from_file(self.ini.get(self.profile, 'DOCKAPP', None))
		self.status_icon.set_from_file(self.ini.get(self.profile, 'DOCKAPP', None))
		self.status_icon.set_visible(True)


		self.map_index = index_map(self)
		self.map_index.check_if_update_needed()

		# Mod Index
		self.mod_index = index_mod(self)
		self.mod_index.check_if_update_needed()

		# Datadirs
		datadirs = self.unitsync_wrapper.datadirs_list()
		self.datadirs = []
		for i in range(0,len(datadirs)):
			if os.path.isdir(datadirs[i]) == True:
				self.datadirs.append(datadirs[i])

		# Classes
		self.battle = battle(self)
		self.lobby = gui_lobby(self)

		self.battle.IntegrateWithLobby(self)
		self.lobby.IntegrateWithBattle(self)

		self.lobby.Create()


		self.battle.Create()

		self.options = config(self)
		self.options.create()

		self.tooltip('Unity Lobby')
		self.blinking(True)
		self.status_icon.connect('activate', self.active)
		self.status_icon.connect('popup-menu', self.popup_menu)
Example #2
0
    def setup(self, progressbar):

        # Get Datadirs from unitsync
        datadir = self.ini.get(self.profile, "SPRING_DATADIR", None)
        if datadir != None:
            os.chdir(datadir)
        unitsync.Init(True, 1)
        self.datadirs = []
        datadirs = unitsync.GetDataDirectories(False)
        for i in range(0, len(datadirs)):
            if os.path.isdir(datadirs[i]) == True:
                self.datadirs.append(datadirs[i])

                # Map Index
        self.map_index = index_map(self.map_index_file, progressbar)
        if os.path.isfile(self.map_index_file) == False:
            self.map_index.create_index()
        self.map_index.check_if_update_needed()

        # Mod Index
        self.mod_index = index_mod(self.mod_index_file, progressbar)
        if os.path.isfile(self.mod_index_file) == False:
            self.mod_index.create_index()
        self.mod_index.check_if_update_needed()

        self.lobby_table = gtk.Table(rows=2, columns=2, homogeneous=False)
        self.gui_lobby = gui_lobby(self)
        self.config = config(self)
        self.battle = battle(self)

        # Main Window
        self.window.set_title("Unity Lobby")
        self.window.set_resizable(True)
        self.window.connect("delete-event", gtk.main_quit)
        self.window.add_events(gtk.gdk.BUTTON_PRESS_MASK)

        # Vertical Box Part 1/2
        vbox = gtk.VBox(False, 0)
        vbox.show()
        self.window.add(vbox)

        # Menu Part 1/2
        menu_bar = gtk.MenuBar()
        menu_bar.show()

        # Battle Notebook
        self.battle_notebook = gtk.Notebook()
        self.battle_notebook.set_tab_pos(gtk.POS_LEFT)
        self.battle.create(self.battle_notebook)

        # Options Notebook
        self.options_notebook = gtk.Notebook()
        self.options_notebook.set_tab_pos(gtk.POS_LEFT)
        self.config.create(self.options_notebook)

        # Vertical Box Part 2/2
        vbox.pack_start(menu_bar, False, False, 2)
        vbox.pack_start(self.battle_notebook, True, True, 2)
        vbox.pack_start(self.options_notebook, True, True, 2)
        vbox.pack_start(self.lobby_table, True, True, 2)

        self.window.show()

        # Menu Part 2/2
        # Menu Items
        battle_item = gtk.MenuItem("Battle")
        lobby_item = gtk.MenuItem("Lobby")
        config_item = gtk.MenuItem("Options")
        self.start_item = gtk.MenuItem("Start")
        menu_bar.append(battle_item)
        menu_bar.append(lobby_item)
        menu_bar.append(config_item)
        menu_bar.append(self.start_item)

        battle_item.show()
        lobby_item.show()
        self.start_item.set_right_justified(1)
        config_item.show()

        # Menu-Connect
        battle_item.connect("button_press_event", self.battle_section)
        config_item.connect("button_press_event", self.config_section)
        self.start_item.connect("button_press_event", self.battle.script_create)
        lobby_item.connect("button_press_event", self.lobby_section)

        # Main Window destory event
        self.window.connect("delete-event", self.destroy)

        self.battle_section(None, None)
Example #3
0
    def setup(self, progressbar):

        # Get Datadirs from unitsync
        datadir = self.ini.get(self.profile, 'SPRING_DATADIR', None)
        if datadir != None:
            os.chdir(datadir)
        unitsync.Init(True, 1)
        self.datadirs = []
        datadirs = unitsync.GetDataDirectories(False)
        for i in range(0, len(datadirs)):
            if os.path.isdir(datadirs[i]) == True:
                self.datadirs.append(datadirs[i])

        # Map Index
        self.map_index = index_map(self.map_index_file, progressbar)
        if os.path.isfile(self.map_index_file) == False:
            self.map_index.create_index()
        self.map_index.check_if_update_needed()

        # Mod Index
        self.mod_index = index_mod(self.mod_index_file, progressbar)
        if os.path.isfile(self.mod_index_file) == False:
            self.mod_index.create_index()
        self.mod_index.check_if_update_needed()

        self.lobby_table = gtk.Table(rows=2, columns=2, homogeneous=False)
        self.gui_lobby = gui_lobby(self)
        self.config = config(self)
        self.battle = battle(self)

        # Main Window
        self.window.set_title("Unity Lobby")
        self.window.set_resizable(True)
        self.window.connect("delete-event", gtk.main_quit)
        self.window.add_events(gtk.gdk.BUTTON_PRESS_MASK)

        # Vertical Box Part 1/2
        vbox = gtk.VBox(False, 0)
        vbox.show()
        self.window.add(vbox)

        # Menu Part 1/2
        menu_bar = gtk.MenuBar()
        menu_bar.show()

        # Battle Notebook
        self.battle_notebook = gtk.Notebook()
        self.battle_notebook.set_tab_pos(gtk.POS_LEFT)
        self.battle.create(self.battle_notebook)

        # Options Notebook
        self.options_notebook = gtk.Notebook()
        self.options_notebook.set_tab_pos(gtk.POS_LEFT)
        self.config.create(self.options_notebook)

        #Vertical Box Part 2/2
        vbox.pack_start(menu_bar, False, False, 2)
        vbox.pack_start(self.battle_notebook, True, True, 2)
        vbox.pack_start(self.options_notebook, True, True, 2)
        vbox.pack_start(self.lobby_table, True, True, 2)

        self.window.show()

        # Menu Part 2/2
        #Menu Items
        battle_item = gtk.MenuItem("Battle")
        lobby_item = gtk.MenuItem("Lobby")
        config_item = gtk.MenuItem("Options")
        self.start_item = gtk.MenuItem("Start")
        menu_bar.append(battle_item)
        menu_bar.append(lobby_item)
        menu_bar.append(config_item)
        menu_bar.append(self.start_item)

        battle_item.show()
        lobby_item.show()
        self.start_item.set_right_justified(1)
        config_item.show()

        #Menu-Connect
        battle_item.connect("button_press_event", self.battle_section)
        config_item.connect("button_press_event", self.config_section)
        self.start_item.connect("button_press_event",
                                self.battle.script_create)
        lobby_item.connect("button_press_event", self.lobby_section)

        # Main Window destory event
        self.window.connect("delete-event", self.destroy)

        self.battle_section(None, None)