示例#1
0
    def __init__(self, parent: wx.Notebook, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        parent.GetParent().Connect(-1, -1, models.EVT_APP_CLEAR,
                                   self.OnClearApp)
        parent.GetParent().Connect(-1, -1, models.EVT_CALC_RAIDGROUPS,
                                   self.OnCalcRaidGroups)

        config.RAID_GROUPS = raidgroups.GroupBuilder()

        ###########################
        # Raid Groups Frame (Tab 5)
        ###########################
        self.raidgroups_main_box = wx.WrapSizer()
        self.label_font = wx.Font(11, wx.DEFAULT, wx.DEFAULT, wx.BOLD)

        self.no_groups_text = wx.StaticText(
            self,
            label="No raid groups have been calculated.\n\n"
            "Please select an entry from the Attendance Logs "
            "panel to use for group calculation.")
        self.no_groups_text.SetFont(self.label_font)
        self.raidgroups_main_box.Add(self.no_groups_text,
                                     flag=wx.TOP | wx.LEFT,
                                     border=10)

        # Finalize Tab
        self.SetSizer(self.raidgroups_main_box)
        parent.AddPage(self, 'Raid Groups')
示例#2
0
    def __init__(self, parent: wx.Notebook, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        parent.GetParent().Connect(-1, -1, models.EVT_KILL, self.OnKill)
        parent.GetParent().Connect(-1, -1, models.EVT_APP_CLEAR,
                                   self.OnClearApp)

        ###########################
        # Kill Timers Frame (Tab 4)
        ###########################
        killtimers_main_box = wx.BoxSizer(wx.VERTICAL)

        # List
        killtimers_list = ObjectListView.GroupListView(self,
                                                       wx.ID_ANY,
                                                       style=wx.LC_REPORT,
                                                       size=wx.Size(600, 1080),
                                                       useExpansionColumn=True)
        killtimers_main_box.Add(killtimers_list, flag=wx.EXPAND | wx.ALL)
        self.killtimers_list = killtimers_list

        def killtimerGroupKey(kill):
            group_key = kill.island()
            return group_key

        killtimers_list.SetColumns([
            ObjectListView.ColumnDefn("Time",
                                      "left",
                                      180,
                                      "time",
                                      groupKeyGetter=killtimerGroupKey,
                                      groupKeyConverter='Island %s',
                                      fixedWidth=180),
            ObjectListView.ColumnDefn("Mob",
                                      "left",
                                      400,
                                      "name",
                                      groupKeyGetter=killtimerGroupKey,
                                      groupKeyConverter='Island %s',
                                      fixedWidth=400),
        ])
        killtimers_list.SetObjects(config.KILL_TIMERS)
        killtimers_list.SetEmptyListMsg("No tracked mob deaths witnessed.")

        # Finalize Tab
        self.SetSizer(killtimers_main_box)
        parent.AddPage(self, 'Time of Death Tracking')
示例#3
0
    def __init__(self, parent: wx.Notebook, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        parent.GetParent().Connect(-1, -1, models.EVT_WHO_HISTORY,
                                   self.OnWhoHistory)
        parent.GetParent().Connect(-1, -1, models.EVT_CREDITT,
                                   self.OnCreditt)
        parent.GetParent().Connect(-1, -1, models.EVT_GRATSS,
                                   self.OnGratss)
        parent.GetParent().Connect(-1, -1, models.EVT_APP_CLEAR,
                                   self.OnClearApp)

        ##############################
        # Attendance Log Frame (Tab 2)
        ##############################
        attendance_main_box = wx.BoxSizer(wx.VERTICAL)
        attendance_splitter = wx.lib.splitter.MultiSplitterWindow(
            self, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER)
        attendance_splitter.SetOrientation(wx.VERTICAL)
        pane_1 = wx.Panel(attendance_splitter, wx.ID_ANY)
        pane_2 = wx.Panel(attendance_splitter, wx.ID_ANY)
        pane_3 = wx.Panel(attendance_splitter, wx.ID_ANY)

        # Attendance / Raidtick List
        attendance_box = wx.BoxSizer(wx.HORIZONTAL)
        attendance_list = ObjectListView.ObjectListView(
            pane_1, wx.ID_ANY, style=wx.LC_REPORT,
            size=wx.Size(680, 600))
        attendance_box.Add(attendance_list, flag=wx.EXPAND | wx.ALL)
        attendance_list.Bind(wx.EVT_LEFT_DCLICK, self.ShowAttendanceDetail)
        attendance_list.Bind(wx.EVT_RIGHT_DCLICK, self.OnMarkRaidtick)
        self.attendance_list = attendance_list

        attendance_list.SetColumns([
            ObjectListView.ColumnDefn(
                "Time", "left", 140, "time",
                fixedWidth=140),
            ObjectListView.ColumnDefn(
                "Name", "left", 140, "tick_name",
                fixedWidth=140),
            ObjectListView.ColumnDefn(
                "RT", "left", 25, "raidtick_display",
                fixedWidth=25),
            ObjectListView.ColumnDefn(
                "Populations", "left", 357, "populations",
                fixedWidth=357),
        ])
        attendance_list.SetObjects(config.ATTENDANCE_LOGS)
        attendance_list.SetEmptyListMsg(
            "No who log history.\nPlease type `/who` ingame.")
        attendance_list.SetToolTip(
            "Double left-click an attendance record to edit it in a detailed "
            "view.\n"
            "Double right-click an attendance record to toggle its RaidTick "
            "status.")

        # Attendance / Raidtick Buttons
        attendance_buttons_box = wx.BoxSizer(wx.VERTICAL)
        attendance_box.Add(attendance_buttons_box,
                           flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)
        attendance_button_raidtick = wx.CheckBox(
            pane_1, label="Show RaidTicks Only")
        attendance_buttons_box.Add(attendance_button_raidtick,
                                   flag=wx.ALL, border=6)
        attendance_button_raidtick.Bind(wx.EVT_CHECKBOX, self.OnRaidtickOnly)
        self.attendance_button_raidtick = attendance_button_raidtick
        attendance_button_raidtick.SetValue(config.SHOW_RAIDTICK_ONLY)
        if config.SHOW_RAIDTICK_ONLY:
            self.OnRaidtickOnly(None)

        attendance_toggle_raidtick = wx.Button(
            pane_1, label="Toggle RaidTick", size=(140, 22))
        attendance_toggle_raidtick.Bind(wx.EVT_BUTTON, self.OnMarkRaidtick)
        attendance_buttons_box.Add(
            attendance_toggle_raidtick, border=5, flag=wx.ALL)

        attendance_use_raidgroups = wx.Button(
            pane_1, label="Calculate Raid Groups", size=(140, 22))
        attendance_use_raidgroups.Bind(wx.EVT_BUTTON, self.OnCalcRaidGroups)
        attendance_buttons_box.Add(
            attendance_use_raidgroups, border=5, flag=wx.ALL)

        # Creditt Log
        creditt_box = wx.BoxSizer(wx.HORIZONTAL)
        creditt_list = ObjectListView.ObjectListView(
            pane_2, wx.ID_ANY, style=wx.LC_REPORT,
            size=wx.Size(650, 200))
        creditt_box.Add(creditt_list, flag=wx.EXPAND | wx.ALL)
        # creditt_list.Bind(wx.EVT_LEFT_DCLICK, self.OnEditCreditt)
        self.creditt_list = creditt_list

        creditt_list.SetColumns([
            ObjectListView.ColumnDefn(
                "Time", "left", 160, "time",
                fixedWidth=160),
            ObjectListView.ColumnDefn(
                "From", "left", 120, "user",
                fixedWidth=120),
            ObjectListView.ColumnDefn(
                "Message", "left", 350, "message",
                fixedWidth=350),
        ])
        creditt_list.SetObjects(config.CREDITT_LOG)
        creditt_list.SetEmptyListMsg("No creditt messages received.")

        # Creditt Buttons
        creditt_buttons_box = wx.BoxSizer(wx.VERTICAL)
        creditt_box.Add(creditt_buttons_box,
                        flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)
        creditt_button_ignore = wx.Button(
            pane_2, label="Ignore Creditt", size=(140, 22))
        creditt_buttons_box.Add(creditt_button_ignore)
        creditt_button_ignore.Bind(wx.EVT_BUTTON, self.OnIgnoreCreditt)

        # Gratss Log
        gratss_box = wx.BoxSizer(wx.HORIZONTAL)
        gratss_list = ObjectListView.ObjectListView(
            pane_3, wx.ID_ANY, style=wx.LC_REPORT,
            size=wx.Size(650, 200))
        gratss_box.Add(gratss_list, flag=wx.EXPAND | wx.ALL)
        # gratss_list.Bind(wx.EVT_LEFT_DCLICK, self.OnEditGratss)
        self.gratss_list = gratss_list

        gratss_list.SetColumns([
            ObjectListView.ColumnDefn(
                "Time", "left", 160, "time",
                fixedWidth=160),
            ObjectListView.ColumnDefn(
                "From", "left", 120, "user",
                fixedWidth=120),
            ObjectListView.ColumnDefn(
                "Message", "left", 350, "message",
                fixedWidth=350),
        ])
        gratss_list.SetObjects(config.GRATSS_LOG)
        gratss_list.SetEmptyListMsg("No gratss messages received.")

        # Gratss Buttons
        gratss_buttons_box = wx.BoxSizer(wx.VERTICAL)
        gratss_box.Add(gratss_buttons_box,
                       flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)
        gratss_button_ignore = wx.Button(
            pane_3, label="Ignore Gratss", size=(140, 22))
        gratss_buttons_box.Add(gratss_button_ignore)
        gratss_button_ignore.Bind(wx.EVT_BUTTON, self.OnIgnoreGratss)

        # Set up Splitter
        pane_1.SetSizer(attendance_box)
        pane_2.SetSizer(creditt_box)
        pane_3.SetSizer(gratss_box)
        attendance_splitter.AppendWindow(pane_1)
        attendance_splitter.AppendWindow(pane_2)
        attendance_splitter.AppendWindow(pane_3)
        attendance_main_box.Add(attendance_splitter, 1, wx.EXPAND, 0)

        # Finalize Tab
        self.SetSizer(attendance_main_box)
        attendance_main_box.Fit(self)
        attendance_splitter.SetMinimumPaneSize(80)
        attendance_splitter.SetSashPosition(0, config.CREDITT_SASH_POS)
        attendance_splitter.SetSashPosition(1, config.GRATSS_SASH_POS)
        self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged,
                  source=attendance_splitter)
        parent.AddPage(self, 'Attendance Logs')
示例#4
0
    def __init__(self, parent: wx.Notebook, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        parent.GetParent().Connect(-1, -1, models.EVT_DROP, self.OnDrop)
        parent.GetParent().Connect(-1, -1, models.EVT_BID, self.OnBid)
        parent.GetParent().Connect(-1, -1, models.EVT_APP_CLEAR,
                                   self.OnClearApp)
        #######################
        # Bidding Frame (Tab 1)
        #######################
        # bidding_frame = wx.Window(notebook)
        bidding_splitter = wx.lib.splitter.MultiSplitterWindow(
            self, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER)
        bidding_splitter.SetOrientation(wx.VERTICAL)
        pane_1 = wx.Panel(bidding_splitter, wx.ID_ANY)
        pane_2 = wx.Panel(bidding_splitter, wx.ID_ANY)
        pane_3 = wx.Panel(bidding_splitter, wx.ID_ANY)
        bidding_main_box1 = wx.BoxSizer(wx.VERTICAL)
        bidding_main_box2 = wx.BoxSizer(wx.VERTICAL)
        bidding_main_box3 = wx.BoxSizer(wx.VERTICAL)
        label_font = wx.Font(11, wx.DEFAULT, wx.DEFAULT, wx.BOLD)

        # ----------------
        # Pending Loot Box
        # ----------------
        pending_label = wx.StaticText(
            pane_1, label="Pending Drops", style=wx.ALIGN_LEFT)
        pending_label.SetFont(label_font)
        bidding_main_box1.Add(
            pending_label, flag=wx.LEFT | wx.TOP, border=10)
        pending_box = wx.BoxSizer(wx.HORIZONTAL)
        bidding_main_box1.Add(
            pending_box, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10)

        # List
        pending_list = ObjectListView.ObjectListView(
            pane_1, wx.ID_ANY, size=wx.Size(725, 1000),
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        pending_box.Add(pending_list, flag=wx.EXPAND)
        pending_list.Bind(wx.EVT_COMMAND_LEFT_CLICK, self.UpdateMinDKP)
        pending_list.Bind(wx.EVT_LEFT_DCLICK, self.OnIgnorePending)
        self.pending_list = pending_list

        pending_list.SetColumns([
            ObjectListView.ColumnDefn("Report Time", "left", 170, "timestamp",
                                      fixedWidth=170),
            ObjectListView.ColumnDefn("Reporter", "left", 95, "reporter",
                                      fixedWidth=95),
            ObjectListView.ColumnDefn("Item", "left", 225, "name",
                                      fixedWidth=225),
            ObjectListView.ColumnDefn("Min. DKP", "center", 61, "min_dkp",
                                      fixedWidth=61),
            ObjectListView.ColumnDefn("Restrictions", "left", 85, "classes",
                                      fixedWidth=85),
            ObjectListView.ColumnDefn("Droppable", "center", 70, "droppable",
                                      fixedWidth=70),
        ])
        pending_list.SetObjects(config.PENDING_AUCTIONS)
        pending_list.SetEmptyListMsg("No drops pending.")
        pending_list.SetToolTip("Double click an item to ignore it")

        # Buttons
        pending_buttons_box = wx.BoxSizer(wx.VERTICAL)
        pending_box.Add(pending_buttons_box,
                        flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)

        pending_button_ignore = wx.Button(pane_1, label="Ignore")
        pending_button_dkp = wx.Button(pane_1, label="DKP Bid")
        pending_button_roll = wx.Button(pane_1, label="Roll")
        # pending_buttonspacer = wx.StaticLine(self)
        pending_button_wiki = wx.Button(pane_1, label="Wiki?")
        pending_buttons_box.Add(pending_button_ignore, flag=wx.TOP)
        pending_buttons_box.Add(pending_button_dkp, flag=wx.TOP, border=10)
        pending_buttons_box.Add(pending_button_roll, flag=wx.TOP, border=10)
        # pending_buttons_box.Add(pending_buttonspacer, flag=wx.TOP, border=10)
        pending_buttons_box.Add(pending_button_wiki, flag=wx.TOP, border=10)
        min_dkp_font = wx.Font(10, wx.DEFAULT, wx.DEFAULT, wx.BOLD)
        min_dkp_label = wx.StaticText(
            pane_1, label="Min. DKP")
        min_dkp_label.SetFont(min_dkp_font)
        min_dkp_spinner = wx.SpinCtrl(pane_1, value=str(config.MIN_DKP))
        min_dkp_spinner.SetRange(0, 10000)
        min_dkp_spinner.Bind(wx.EVT_SPINCTRL, self.OnMinDkpSpin)
        self.min_dkp_spinner = min_dkp_spinner
        pending_buttons_box.Add(min_dkp_label,
                                flag=wx.TOP | wx.LEFT, border=10)
        pending_buttons_box.Add(min_dkp_spinner, flag=wx.LEFT, border=10)

        pending_button_ignore.Bind(wx.EVT_BUTTON, self.OnIgnorePending)
        pending_button_dkp.Bind(wx.EVT_BUTTON, self.StartAuctionDKP)
        pending_button_roll.Bind(wx.EVT_BUTTON, self.StartAuctionRandom)
        pending_button_wiki.Bind(wx.EVT_BUTTON, self.ShowWikiPending)

        # ---------------
        # Active Loot Box
        # ---------------
        active_label = wx.StaticText(
            pane_2, label="Active Auctions", style=wx.ALIGN_LEFT)
        active_label.SetFont(label_font)
        bidding_main_box2.Add(
            active_label, flag=wx.LEFT | wx.TOP, border=10)
        active_box = wx.BoxSizer(wx.HORIZONTAL)
        bidding_main_box2.Add(
            active_box, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10)

        # List
        active_list = ObjectListView.ObjectListView(
            pane_2, wx.ID_ANY, size=wx.Size(725, 1000),
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        active_box.Add(active_list, flag=wx.EXPAND)
        active_list.Bind(wx.EVT_LEFT_DCLICK, self.ShowActiveDetail)
        self.active_list = active_list

        active_list.SetColumns([
            ObjectListView.ColumnDefn("Item", "left", 215, "name",
                                      fixedWidth=215),
            ObjectListView.ColumnDefn("Restrictions", "left", 95, "classes",
                                      fixedWidth=95),
            ObjectListView.ColumnDefn("Droppable", "center", 70, "droppable",
                                      fixedWidth=70),
            ObjectListView.ColumnDefn("Rand/Min", "left", 70, "get_target_min",
                                      fixedWidth=70),
            ObjectListView.ColumnDefn("Bid/Roll", "left", 65, "highest_number",
                                      fixedWidth=65),
            ObjectListView.ColumnDefn("Leading", "left", 90, "highest_players",
                                      fixedWidth=90),
            ObjectListView.ColumnDefn("Time Left", "left", 100,
                                      "time_remaining_text",
                                      fixedWidth=100),
        ])
        active_list.SetObjects(list(config.ACTIVE_AUCTIONS.values()))
        active_list.SetEmptyListMsg("No auctions pending.")
        active_list.SetToolTip(
            "Double click an auction to edit bid the history")
        self.active_list_refresh_timer = wx.Timer(self, id=1)
        self.Bind(wx.EVT_TIMER, self.refresh_active_list,
                  self.active_list_refresh_timer)
        self.active_list_refresh_timer.Start(1000)

        # Buttons
        active_buttons_box = wx.BoxSizer(wx.VERTICAL)
        active_box.Add(active_buttons_box,
                       flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)

        active_button_undo = wx.Button(pane_2, label="Undo")
        active_buttonspacer = wx.StaticLine(pane_2)
        active_buttons_timebox = wx.BoxSizer(wx.HORIZONTAL)
        self.active_buttons_timespinner = wx.SpinCtrl(
            pane_2, min=1, max=30, initial=1, size=(40, 22))
        self.active_buttons_timespinner.SetToolTip("Minutes to add/remove")
        active_button_timeadd = wx.Button(pane_2, label="+", size=(15, 22))
        active_button_timeadd.SetToolTip("Add time to Auction")
        active_button_timesub = wx.Button(pane_2, label="-", size=(15, 22))
        active_button_timesub.SetToolTip("Remove time from Auction")
        active_buttons_timebox.Add(active_button_timesub)
        active_buttons_timebox.Add(self.active_buttons_timespinner)
        active_buttons_timebox.Add(active_button_timeadd)
        active_button_gettext = wx.Button(pane_2, label="Copy Bid")
        active_button_complete = wx.Button(pane_2, label="Complete")
        active_button_wiki = wx.Button(pane_2, label="Wiki?")
        active_cb_bid_target = wx.ComboBox(
            pane_2, size=wx.Size(70, 22),
            choices=list(config.BID_CHANNEL_OPTIONS),
            value=config.PRIMARY_BID_CHANNEL,
            style=wx.CB_READONLY)
        active_cb_bid_target.SetToolTip("Selected channel will be used for "
                                        "Auction clipboard messages")
        active_buttons_box.Add(active_button_undo, flag=wx.TOP)
        active_buttons_box.Add(active_buttonspacer, flag=wx.TOP, border=6)
        active_buttons_box.Add(active_buttons_timebox, flag=wx.TOP, border=6)
        active_buttons_box.Add(active_button_gettext, flag=wx.TOP, border=6)
        active_buttons_box.Add(active_button_complete, flag=wx.TOP, border=6)
        active_buttons_box.Add(active_button_wiki, flag=wx.TOP, border=6)
        active_buttons_box.Add(active_cb_bid_target, flag=wx.TOP, border=6)

        active_button_undo.Bind(wx.EVT_BUTTON, self.UndoStart)
        active_button_timeadd.Bind(wx.EVT_BUTTON, self.AucTimeDelta)
        active_button_timesub.Bind(wx.EVT_BUTTON, self.AucTimeDelta)
        active_button_gettext.Bind(wx.EVT_BUTTON, self.CopyBidText)
        active_button_complete.Bind(wx.EVT_BUTTON, self.CompleteAuction)
        active_button_wiki.Bind(wx.EVT_BUTTON, self.ShowWikiActive)
        active_cb_bid_target.Bind(wx.EVT_COMBOBOX, self.SelectBidTarget)

        # -------------------
        # Historical Loot Box
        # -------------------
        history_label = wx.StaticText(
            pane_3, label="Historical Auctions", style=wx.ALIGN_LEFT)
        history_label.SetFont(label_font)
        bidding_main_box3.Add(
            history_label, flag=wx.LEFT | wx.TOP, border=10)
        history_box = wx.BoxSizer(wx.HORIZONTAL)
        bidding_main_box3.Add(
            history_box, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10)

        # List
        history_list = ObjectListView.ObjectListView(
            pane_3, wx.ID_ANY, size=wx.Size(725, 1000),
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        history_box.Add(history_list, flag=wx.EXPAND | wx.BOTTOM, border=10)
        history_list.Bind(wx.EVT_LEFT_DCLICK, self.ShowHistoryDetail)
        self.history_list = history_list

        history_list.SetColumns([
            ObjectListView.ColumnDefn("Item", "left", 240, "name",
                                      fixedWidth=240),
            ObjectListView.ColumnDefn("Restrictions", "left", 95, "classes",
                                      fixedWidth=95),
            ObjectListView.ColumnDefn("Droppable", "center", 70, "droppable",
                                      fixedWidth=70),
            ObjectListView.ColumnDefn("Rand/Min", "left", 65, "get_target_min",
                                      fixedWidth=65),
            ObjectListView.ColumnDefn("Bid/Roll", "left", 65, "highest_number",
                                      fixedWidth=65),
            ObjectListView.ColumnDefn("Winner", "left", 108, "highest_players",
                                      fixedWidth=108),
        ])
        history_list.SetObjects(
            list(config.HISTORICAL_AUCTIONS.values()))
        history_list.SetEmptyListMsg("No auctions completed.")
        history_list.SetToolTip(
            "Double click an auction to edit bid the history")

        # Buttons
        history_buttons_box = wx.BoxSizer(wx.VERTICAL)
        history_box.Add(history_buttons_box,
                        flag=wx.EXPAND | wx.TOP | wx.LEFT, border=10)

        history_button_undo = wx.Button(pane_3, label="Undo")
        history_buttonspacer = wx.StaticLine(pane_3)
        history_button_gettext = wx.Button(pane_3, label="Copy Text")
        history_button_wiki = wx.Button(pane_3, label="Wiki?")
        history_button_hiderot = wx.CheckBox(pane_3, label="Hide Rots")
        history_buttons_box.Add(history_button_undo, flag=wx.TOP)
        history_buttons_box.Add(history_buttonspacer, flag=wx.TOP, border=10)
        history_buttons_box.Add(history_button_gettext, flag=wx.TOP, border=10)
        history_buttons_box.Add(history_button_wiki, flag=wx.TOP, border=10)
        history_buttons_box.Add(history_button_hiderot, flag=wx.TOP, border=10)

        history_button_undo.Bind(wx.EVT_BUTTON, self.UndoComplete)
        history_button_gettext.Bind(wx.EVT_BUTTON, self.CopyWinText)
        history_button_wiki.Bind(wx.EVT_BUTTON, self.ShowWikiHistory)
        history_button_hiderot.Bind(wx.EVT_CHECKBOX, self.OnHideRot)
        self.history_button_hiderot = history_button_hiderot
        history_button_hiderot.SetValue(config.HIDE_ROTS)
        if config.HIDE_ROTS:
            self.OnHideRot(None)

        # Finalize Tab
        pane_1.SetSizer(bidding_main_box1)
        pane_2.SetSizer(bidding_main_box2)
        pane_3.SetSizer(bidding_main_box3)
        bidding_splitter.AppendWindow(pane_1)
        bidding_splitter.AppendWindow(pane_2)
        bidding_splitter.AppendWindow(pane_3)
        bidding_main_box = wx.BoxSizer()
        bidding_main_box.Add(bidding_splitter, 1, wx.EXPAND, 0)
        self.SetSizer(bidding_main_box)
        bidding_splitter.SetMinimumPaneSize(215)
        bidding_splitter.SetSashPosition(0, config.ACTIVE_SASH_POS)
        bidding_splitter.SetSashPosition(1, config.HISTORICAL_SASH_POS)
        self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged,
                  source=bidding_splitter)
        parent.AddPage(self, 'Bidding')
示例#5
0
    def __init__(self, parent: wx.Notebook, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        parent.GetParent().Connect(-1, -1, models.EVT_WHO, self.OnWho)
        parent.GetParent().Connect(-1, -1, models.EVT_CLEAR_WHO,
                                   self.OnClearWho)
        parent.GetParent().Connect(-1, -1, models.EVT_WHO_END,
                                   self.ResetPopPreview)
        parent.GetParent().Connect(-1, -1, models.EVT_APP_CLEAR,
                                   self.OnClearApp)
        self.player_affiliations = config.WX_LAST_WHO_SNAPSHOT or list()
        config.WX_LAST_WHO_SNAPSHOT = self.player_affiliations
        self.pop_adjustments = dict()
        self.pop_preview = list()

        ##########################
        # Population Frame (Tab 3)
        ##########################
        label_font = wx.Font(11, wx.DEFAULT, wx.DEFAULT, wx.BOLD)
        population_main_box = wx.BoxSizer(wx.VERTICAL)

        population_label = wx.StaticText(self,
                                         label="Population Count",
                                         style=wx.ALIGN_LEFT)
        population_label.SetFont(label_font)
        population_main_box.Add(population_label,
                                flag=wx.LEFT | wx.TOP,
                                border=10)
        population_box = wx.BoxSizer(wx.HORIZONTAL)
        population_main_box.Add(population_box,
                                flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                                | wx.BOTTOM,
                                border=10)

        # List
        population_list = ObjectListView.GroupListView(self,
                                                       wx.ID_ANY,
                                                       style=wx.LC_REPORT,
                                                       size=wx.Size(625, 1200),
                                                       useExpansionColumn=True)
        population_box.Add(population_list, flag=wx.EXPAND | wx.ALL)
        self.population_list = population_list

        def popGroupKey(player):
            return config.ALLIANCE_MAP.get(player.guild, player.guild or '')

        population_list.SetColumns([
            ObjectListView.ColumnDefn("Name",
                                      "left",
                                      180,
                                      "name",
                                      groupKeyGetter=popGroupKey,
                                      fixedWidth=180),
            ObjectListView.ColumnDefn("Class",
                                      "left",
                                      100,
                                      "pclass",
                                      groupKeyGetter=popGroupKey,
                                      fixedWidth=100),
            ObjectListView.ColumnDefn("Level",
                                      "left",
                                      40,
                                      "level",
                                      groupKeyGetter=popGroupKey,
                                      fixedWidth=40),
            ObjectListView.ColumnDefn("Guild",
                                      "left",
                                      148,
                                      "guild",
                                      groupKeyGetter=popGroupKey,
                                      fixedWidth=148),
        ])
        population_list.SetObjects(self.player_affiliations)
        population_list.SetEmptyListMsg(
            "No player affiliation data loaded.\nPlease type `/who` ingame.")

        # Buttons / Adjustments
        population_buttons_box = wx.BoxSizer(wx.VERTICAL)
        population_box.Add(population_buttons_box,
                           flag=wx.EXPAND | wx.TOP | wx.LEFT,
                           border=10)

        # Autogenerate adjustments for each Alliance
        adj_alliance_font = wx.Font(11, wx.DEFAULT, wx.DEFAULT, wx.BOLD)
        adj_alliance_header = wx.StaticText(self, label="Adjustments:")
        adj_alliance_header.SetFont(adj_alliance_font)
        population_buttons_box.Add(adj_alliance_header,
                                   flag=wx.BOTTOM,
                                   border=10)
        for alliance in config.ALLIANCES:
            adj_alliance_box = wx.GridBagSizer(1, 2)
            adj_alliance_label = wx.StaticText(self,
                                               label=alliance,
                                               size=(100, 20),
                                               style=wx.ALIGN_RIGHT)
            adj_alliance_label.SetFont(adj_alliance_font)
            adj_alliance_spinner = wx.SpinCtrl(self, value='0')
            adj_alliance_spinner.SetRange(-1000, 1000)  # Why limit things? :D
            adj_alliance_spinner.Bind(wx.EVT_SPINCTRL, self.ResetPopPreview)
            self.pop_adjustments[alliance] = adj_alliance_spinner
            adj_alliance_box.Add(adj_alliance_label,
                                 pos=(0, 0),
                                 flag=wx.RIGHT | wx.TOP,
                                 border=3)
            adj_alliance_box.Add(adj_alliance_spinner,
                                 pos=(0, 1),
                                 flag=wx.LEFT,
                                 border=7)
            population_buttons_box.Add(adj_alliance_box,
                                       flag=wx.BOTTOM | wx.EXPAND,
                                       border=10)

        # Small Pop-List Display
        population_preview_list = ObjectListView.ObjectListView(
            self,
            wx.ID_ANY,
            style=wx.LC_REPORT | wx.LC_SINGLE_SEL,
            size=wx.Size(120, 140))
        population_buttons_box.Add(population_preview_list,
                                   flag=wx.EXPAND | wx.ALL)
        self.population_preview_list = population_preview_list

        population_preview_list.SetColumns([
            ObjectListView.ColumnDefn("Alliance",
                                      "left",
                                      125,
                                      "alliance",
                                      fixedWidth=125),
            ObjectListView.ColumnDefn("Pop",
                                      "left",
                                      40,
                                      "population",
                                      fixedWidth=40),
        ])
        population_preview_list.SetObjects(self.pop_preview)
        population_preview_list.SetEmptyListMsg("No pop data found.")

        population_button_half = wx.Button(self, label="Halve")
        population_button_reset = wx.Button(self, label="Reset")
        population_box_half_reset = wx.BoxSizer(wx.HORIZONTAL)
        population_box_half_reset.Add(population_button_half,
                                      flag=wx.LEFT,
                                      border=5)
        population_box_half_reset.Add(population_button_reset,
                                      flag=wx.LEFT,
                                      border=10)

        population_button_poptext = wx.Button(self,
                                              label="Copy Populations",
                                              size=(160, 23))
        population_button_randtext = wx.Button(self,
                                               label="Copy Roll Text",
                                               size=(160, 23))
        population_buttons_box.Add(population_box_half_reset,
                                   flag=wx.TOP | wx.BOTTOM,
                                   border=10)
        population_buttons_box.Add(population_button_poptext,
                                   flag=wx.LEFT | wx.BOTTOM,
                                   border=5)
        population_buttons_box.Add(population_button_randtext,
                                   flag=wx.LEFT | wx.TOP,
                                   border=5)

        population_button_half.Bind(wx.EVT_BUTTON, self.HalvePopPreview)
        population_button_reset.Bind(wx.EVT_BUTTON, self.ResetPopPreview)
        population_button_poptext.Bind(wx.EVT_BUTTON, self.CopyPopText)
        population_button_randtext.Bind(wx.EVT_BUTTON, self.CopyPopRandom)
        self.ResetPopPreview(None)

        # Finalize Tab
        self.SetSizer(population_main_box)
        parent.AddPage(self, 'Population Rolls')