예제 #1
0
    def __init__(self, parent=None, title="NinjaLooter EQ Loot Manager"):
        wx.Frame.__init__(self, parent, title=title, size=(850, 800))
        icon = wx.Icon()
        icon.CopyFromBitmap(
            wx.Bitmap(os.path.join(
                config.PROJECT_DIR, "data", "icons", "ninja_attack.png"),
                      wx.BITMAP_TYPE_ANY))
        self.SetIcon(icon)
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Set up menubar
        menu_bar.MenuBar(self)

        # Set up taskbar icon
        config.WX_TASKBAR_ICON = TaskBarIcon(self)

        # Notebook used to create a tabbed main interface
        notebook = wx.Notebook(self, style=wx.LEFT)

        # Bidding Frame
        self.bidding_frame = bidding_frame.BiddingFrame(notebook)

        # Attendance Frame
        self.attendance_frame = attendance_frame.AttendanceFrame(notebook)

        # Population Frame
        self.population_frame = population_frame.PopulationFrame(notebook)

        # Kill Times Frame
        self.killtimes_frame = killtimes_frame.KillTimesFrame(notebook)

        # Raid Groups Frame
        self.raidgroups_frame = raidgroups_frame.RaidGroupsFrame(notebook)

        self.Show(True)
        if config.ALWAYS_ON_TOP:
            self.SetWindowStyle(self.GetWindowStyle() | wx.STAY_ON_TOP)
        self.parser_thread = logparse.ParseThread(self)
        self.parser_thread.start()

        # Handle automatically switching characters
        if sys.platform != "darwin":  # FileSystemWatcher is buggy on OSX
            self.watcher = wx.FileSystemWatcher()
            self.watcher.Bind(wx.EVT_FSWATCHER, self.OnFilesystemEvent)
            if os.path.isdir(config.LOG_DIRECTORY):
                self.watcher.Add(
                    config.LOG_DIRECTORY,
                    events=wx.FSW_EVENT_CREATE | wx.FSW_EVENT_MODIFY)
            config.WX_FILESYSTEM_WATCHER = self.watcher

        # Show Changelog on new version
        try:
            last_run = semver.VersionInfo.parse(config.LAST_RUN_VERSION)
            current = semver.VersionInfo.parse(config.VERSION)
            if current > last_run:
                ChangeLog(self)
        except (ValueError, TypeError):
            config.LAST_RUN_VERSION = config.VERSION
            config.CONF.set("default", "last_run_version", config.VERSION)
            config.write()
예제 #2
0
 def OnAlwaysOnTop(self, e: wx.MenuEvent):
     config.ALWAYS_ON_TOP = self.alwaysontop_mi.IsChecked()
     self.frame.MenuBar.alwaysontop_mi.Check(config.ALWAYS_ON_TOP)
     config.CONF.set(
         'default', 'always_on_top', str(config.ALWAYS_ON_TOP))
     self.frame.UpdateAlwaysOnTop()
     config.write()
예제 #3
0
 def OnSetBidChannel(e: wx.MenuEvent):
     selected_channels = [
         mi.ItemLabel for mi in e.EventObject.MenuItems if mi.IsChecked()
     ]
     config.MATCH_BID = [
         config.BID_CHANNEL_OPTIONS[chan] for chan in selected_channels
     ]
     logparse.reset_matchers()
     config.CONF.set('default', 'bid_channels', ','.join(selected_channels))
     config.write()
예제 #4
0
 def OnHideRot(self, e: wx.Event):
     config.HIDE_ROTS = self.history_button_hiderot.IsChecked()
     config.CONF.set(
         'default', 'hide_rots', str(config.HIDE_ROTS))
     if config.HIDE_ROTS:
         # Filter by hiding rots
         awarded_auctions = [
             x for x in config.HISTORICAL_AUCTIONS.values() if x.highest()]
         self.history_list.SetObjects(awarded_auctions)
     else:
         self.history_list.SetObjects(
             list(config.HISTORICAL_AUCTIONS.values()))
     config.write()
예제 #5
0
    def OnConfigure(self, e: wx.MenuEvent):
        existing_logdir = config.LOG_DIRECTORY
        if not os.path.isdir(existing_logdir):
            existing_logdir = os.path.dirname(existing_logdir)
        openFileDialog = wx.DirDialog(self.GetParent(), "Select Log Directory",
                                      existing_logdir, wx.DD_DIR_MUST_EXIST)

        result = openFileDialog.ShowModal()
        selected = openFileDialog.GetPath()
        openFileDialog.Destroy()
        if result == wx.ID_OK:
            LOG.info("Selected log directory: %s", selected)
            config.LOG_DIRECTORY = selected
            config.CONF.set('default', 'logdir', selected)
            config.write()
            self.GetParent().parser_thread.abort()
            self.GetParent().parser_thread = logparse.ParseThread(
                self.GetParent())
            self.GetParent().parser_thread.start()
            if config.WX_FILESYSTEM_WATCHER is not None:
                config.WX_FILESYSTEM_WATCHER.RemoveAll()
                config.WX_FILESYSTEM_WATCHER.Add(config.LOG_DIRECTORY,
                                                 events=wx.FSW_EVENT_CREATE
                                                 | wx.FSW_EVENT_MODIFY)
예제 #6
0
 def OnRaidtickOnly(self, e: wx.Event):
     config.SHOW_RAIDTICK_ONLY = self.attendance_button_raidtick.IsChecked()
     config.CONF.set(
         'default', 'raidtick_filter', str(config.SHOW_RAIDTICK_ONLY))
     self.RefreshList()
     config.write()
예제 #7
0
 def SelectBidTarget(e: wx.EVT_COMBOBOX):
     config.PRIMARY_BID_CHANNEL = e.String
     config.CONF.set(
         'default', 'primary_bid_channel', config.PRIMARY_BID_CHANNEL)
     config.write()
예제 #8
0
 def OnClose(self, e: wx.EVT_CLOSE):
     config.LAST_RUN_VERSION = config.VERSION
     config.CONF.set("default", "last_run_version", config.VERSION)
     config.write()
     self.Destroy()
예제 #9
0
 def OnAutoSwapLogfile(self, e: wx.MenuEvent):
     config.AUTO_SWAP_LOGFILE = self.autoswap_mi.IsChecked()
     config.CONF.set('default', 'auto_swap_logfile',
                     str(config.AUTO_SWAP_LOGFILE))
     config.write()
예제 #10
0
 def OnTextAlerts(self, e: wx.MenuEvent):
     config.TEXT_ALERTS = self.text_alerts_mi.IsChecked()
     config.CONF.set('alerts', 'text_enabled', str(config.TEXT_ALERTS))
     config.write()
예제 #11
0
 def OnAudioAlerts(self, e: wx.MenuEvent):
     config.AUDIO_ALERTS = self.audio_alerts_mi.IsChecked()
     config.CONF.set('alerts', 'audio_enabled', str(config.AUDIO_ALERTS))
     config.write()
예제 #12
0
 def OnNodropOnly(self, e: wx.MenuEvent):
     config.NODROP_ONLY = self.nodrop_only_mi.IsChecked()
     config.CONF.set('default', 'nodrop_only', str(config.NODROP_ONLY))
     config.write()
예제 #13
0
 def OnRestrict(self, e: wx.MenuEvent):
     config.RESTRICT_BIDS = self.restrict_mi.IsChecked()
     config.CONF.set('default', 'restrict_bids', str(config.RESTRICT_BIDS))
     config.write()
예제 #14
0
 def OnExportTimezone(self, e: wx.MenuEvent):
     config.EXPORT_TIME_IN_EASTERN = self.export_tz_mi.IsChecked()
     config.CONF.set('default', 'export_time_in_eastern',
                     str(config.EXPORT_TIME_IN_EASTERN))
     config.write()
예제 #15
0
 def OnSetAlliance(e: wx.MenuEvent):
     menu_item = [mi for mi in e.EventObject.MenuItems if mi.Id == e.Id][0]
     config.DEFAULT_ALLIANCE = menu_item.ItemLabel
     config.CONF.set('default', 'default_alliance', config.DEFAULT_ALLIANCE)
     config.write()