<commit_before>import rexviewer as r
import PythonQt
from PythonQt.QtUiTools import QUiLoader
from PythonQt.QtGui import QWidget, QMessageBox
from PythonQt.QtCore import QFile
import Queue
import sys
#from PythonQt.QtCore import QStringList

import traceback



class IncomingMessagesHandler():
    
    def __init__(self, queue, endmethod):
        self.queue = queue
        self.endmethod = endmethod
        self.handlers = {}
        
    def on_exit(self):
        try:
            # end incoming loop
            self.endmethod()
            self.queue.put('__end__', 'none')
            
            self.proxywidget.hide()
            uism = r.getUiSceneManager()
            uism.RemoveProxyWidgetFromScene(self.proxywidget)
            return True
        except:
            r.logInfo("LocalSceneWindow failure:")
            traceback.print_exc()
            return False

    def processIncoming(self):
        while(self.queue.qsize()):
            try:
                tag = None
                msg = None
                entry = self.queue.get(0)
                try:
                    tag, msg = entry
                except:
                    r.logInfo("LocalSceneWindow wrong type of incoming input:")
                    r.logInfo(entry)
                    continue
                if(self.handlers.__contains__(tag)):
                    #print "calling", tag
                    self.handlers[tag](msg)
                    continue
                if(tag=="__end__"):
                    #self.controller.isrunning = 0
                    self.endmethod()
                    return
                #print "no handler"
            except Queue.Empty:
                pass

    def addHandler(self, tag, method):
        self.handlers[tag]=method
        

    
    
    
class EstateManagementWindow(QWidget, IncomingMessagesHandler):

    UIFILE = "pymodules/estatemanagement/estatemanagement.ui"
    def __init__(self, controller, queue):
        loader = QUiLoader()
        #uifile = QFile("pymodules/estatemanagement/estatemanagement.ui")
        uifile = QFile(EstateManagementWindow.UIFILE)
        self.gui = loader.load(uifile)
        self.controller = controller
        IncomingMessagesHandler.__init__(self, queue, self.endMethod)        
        
        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1) #1 is ModuleWidget, shown at toolbar
        uiprops.SetMenuGroup(2) #2 is server tools group
        uiprops.widget_name_ = "Estate Management"
        
        self.proxywidget = r.createUiProxyWidget(self.gui, uiprops)
        
        if not uism.AddProxyWidget(self.proxywidget):
            r.logInfo("Adding the ProxyWidget to the bar failed.")
        
        self.btnLoadEstate = self.gui.findChild("QPushButton", "btnLoadEstate")
        self.listWEI = self.gui.findChild("QListWidget","listWidgetEstateInfo")
        self.listWRU = self.gui.findChild("QListWidget","listWidgetRegionUsers")
        self.listWEB = self.gui.findChild("QListWidget","listWidgetBanList")
        self.listWAL = self.gui.findChild("QListWidget","listWidgetAccessList")
        self.listWEM = self.gui.findChild("QListWidget","listWidgetEstateManagers")
        self.listWSU = self.gui.findChild("QListWidget","listWidgetSavedUsers")
        
        self.labelEstateInfo = self.gui.findChild("QLabel","labelEstateInfo")
        
        self.tableEstates = self.gui.findChild("QListWidget","tableWidgetEstates")        
        
        
        self.chkEstateAccess = self.gui.findChild("QCheckBox","checkBoxEstateAccess")


        self.chkSunFixed = self.gui.findChild("QCheckBox", "checkBoxSunFixed");
        # PublicAllowed
        # ExternallyVisible);
        self.chkAllowVoice = self.gui.findChild("QCheckBox", "checkBoxAllowVoice")
        self.chkAllowDirectTeleport = self.gui.findChild("QCheckBox", "checkBoxAllowDirectTeleport")
        self.chkDenyAnonymous = self.gui.findChild("QCheckBox", "checkBoxDenyAnonymous")
        self.chkDenyIdentified = self.gui.findChild("QCheckBox", "checkBoxDenyIdentified")
        self.chkDenyTransacted = self.gui.findChild("QCheckBox", "checkBoxDenyTransacted")
        self.chkAbuseEmailToEstateOwner = self.gui.findChild("QCheckBox", "checkBoxAbuseEmailToEstateOwner")
        self.chkBlockDwell = self.gui.findChild("QCheckBox", "checkBoxBlockDwell")
        self.chkEstateSkipScripts = self.gui.findChild("QCheckBox", "checkBoxEstateSkipScripts")
        self.chkResetHomeOnTeleport = self.gui.findChild("QCheckBox", "checkBoxResetHomeOnTeleport")
        self.chkTaxFree = self.gui.findChild("QCheckBox", "checkBoxTaxFree")
        self.chkDenyAgeUnverified = self.gui.findChild("QCheckBox", "checkBoxDenyAgeUnverified")



        self.btnLoadEstate.connect("clicked(bool)", self.btnLoadEstateClicked)
        
        self.btnToBan = self.gui.findChild("QPushButton", "pushButtonToBan")
        self.btnToAccess = self.gui.findChild("QPushButton", "pushButtonToAccess")
        self.btnToManagers = self.gui.findChild("QPushButton", "pushButtonToManagers")
        self.btnSaveUserInfo = self.gui.findChild("QPushButton", "pushButtonSaveUserInfo")
        
        self.btnRemoveBan = self.gui.findChild("QPushButton", "pushButtonRemoveBan")
        self.btnRemoveAccess = self.gui.findChild("QPushButton", "pushButtonRemoveAccess")
        self.btnRemoveManagers = self.gui.findChild("QPushButton", "pushButtonRemoveManager")        
        self.btnRemoveSaved = self.gui.findChild("QPushButton", "pushButtonRemoveSaved")
        
        self.btnSavedToAccess = self.gui.findChild("QPushButton", "pushButtonSavedToAccess")
        self.btnSavedToBan = self.gui.findChild("QPushButton", "pushButtonSavedToBan")
        self.btnSavedToManagers = self.gui.findChild("QPushButton", "pushButtonSavedToManagers")
        
        self.btnKick = self.gui.findChild("QPushButton", "pushButtonKick")
        self.btnRequestGodLikePowers = self.gui.findChild("QPushButton", "pushButtonRequestGodLikePowers")
        self.lineKickMessage = self.gui.findChild("QLineEdit","lineEditKickMessage")
        
        
        self.btnToBan.connect("clicked(bool)", self.btnToBanClicked)
        self.btnToAccess.connect("clicked(bool)", self.btnToAccessClicked)
        self.btnToManagers.connect("clicked(bool)", self.btnToManagersClicked)
        self.btnSaveUserInfo.connect("clicked(bool)", self.btnSaveUserInfoClicked)

        self.btnRemoveBan.connect("clicked(bool)", self.btnRemoveBanClicked)
        self.btnRemoveAccess.connect("clicked(bool)", self.btnRemoveAccessClicked)
        self.btnRemoveManagers.connect("clicked(bool)", self.btnRemoveManagersClicked)
        
        self.btnRemoveSaved.connect("clicked(bool)", self.btnRemoveSavedClicked)

        self.btnSavedToAccess.connect("clicked(bool)", self.btnSavedToAccessClicked)
        self.btnSavedToBan.connect("clicked(bool)", self.btnSavedToBanClicked)
        self.btnSavedToManagers.connect("clicked(bool)", self.btnSavedToManagersClicked)
        
        self.btnRequestGodLikePowers.connect("clicked(bool)", self.btnRequestGodLikePowersClicked)
        self.btnKick.connect("clicked(bool)", self.btnKickClicked)

        #self.chkEstateAccess.connect("toggled(bool)", self.chkEstateAccessToggled)        <commit_msg>enable estate public mode modification<commit_after>import rexviewer as r
import PythonQt
from PythonQt.QtUiTools import QUiLoader
from PythonQt.QtGui import QWidget, QMessageBox
from PythonQt.QtCore import QFile
import Queue
import sys
#from PythonQt.QtCore import QStringList

import traceback



class IncomingMessagesHandler():
    
    def __init__(self, queue, endmethod):
        self.queue = queue
        self.endmethod = endmethod
        self.handlers = {}
        
    def on_exit(self):
        try:
            # end incoming loop
            self.endmethod()
            self.queue.put('__end__', 'none')
            
            self.proxywidget.hide()
            uism = r.getUiSceneManager()
            uism.RemoveProxyWidgetFromScene(self.proxywidget)
            return True
        except:
            r.logInfo("LocalSceneWindow failure:")
            traceback.print_exc()
            return False

    def processIncoming(self):
        while(self.queue.qsize()):
            try:
                tag = None
                msg = None
                entry = self.queue.get(0)
                try:
                    tag, msg = entry
                except:
                    r.logInfo("LocalSceneWindow wrong type of incoming input:")
                    r.logInfo(entry)
                    continue
                if(self.handlers.__contains__(tag)):
                    #print "calling", tag
                    self.handlers[tag](msg)
                    continue
                if(tag=="__end__"):
                    #self.controller.isrunning = 0
                    self.endmethod()
                    return
                #print "no handler"
            except Queue.Empty:
                pass

    def addHandler(self, tag, method):
        self.handlers[tag]=method
        

    
    
    
class EstateManagementWindow(QWidget, IncomingMessagesHandler):

    UIFILE = "pymodules/estatemanagement/estatemanagement.ui"
    def __init__(self, controller, queue):
        loader = QUiLoader()
        #uifile = QFile("pymodules/estatemanagement/estatemanagement.ui")
        uifile = QFile(EstateManagementWindow.UIFILE)
        self.gui = loader.load(uifile)
        self.controller = controller
        IncomingMessagesHandler.__init__(self, queue, self.endMethod)        
        
        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1) #1 is ModuleWidget, shown at toolbar
        uiprops.SetMenuGroup(2) #2 is server tools group
        uiprops.widget_name_ = "Estate Management"
        
        self.proxywidget = r.createUiProxyWidget(self.gui, uiprops)
        
        if not uism.AddProxyWidget(self.proxywidget):
            r.logInfo("Adding the ProxyWidget to the bar failed.")
        
        self.btnLoadEstate = self.gui.findChild("QPushButton", "btnLoadEstate")
        self.listWEI = self.gui.findChild("QListWidget","listWidgetEstateInfo")
        self.listWRU = self.gui.findChild("QListWidget","listWidgetRegionUsers")
        self.listWEB = self.gui.findChild("QListWidget","listWidgetBanList")
        self.listWAL = self.gui.findChild("QListWidget","listWidgetAccessList")
        self.listWEM = self.gui.findChild("QListWidget","listWidgetEstateManagers")
        self.listWSU = self.gui.findChild("QListWidget","listWidgetSavedUsers")
        
        self.labelEstateInfo = self.gui.findChild("QLabel","labelEstateInfo")
        
        self.tableEstates = self.gui.findChild("QListWidget","tableWidgetEstates")        
        
        
        self.chkEstateAccess = self.gui.findChild("QCheckBox","checkBoxEstateAccess")


        self.chkSunFixed = self.gui.findChild("QCheckBox", "checkBoxSunFixed");
        # PublicAllowed
        # ExternallyVisible);
        self.chkAllowVoice = self.gui.findChild("QCheckBox", "checkBoxAllowVoice")
        self.chkAllowDirectTeleport = self.gui.findChild("QCheckBox", "checkBoxAllowDirectTeleport")
        self.chkDenyAnonymous = self.gui.findChild("QCheckBox", "checkBoxDenyAnonymous")
        self.chkDenyIdentified = self.gui.findChild("QCheckBox", "checkBoxDenyIdentified")
        self.chkDenyTransacted = self.gui.findChild("QCheckBox", "checkBoxDenyTransacted")
        self.chkAbuseEmailToEstateOwner = self.gui.findChild("QCheckBox", "checkBoxAbuseEmailToEstateOwner")
        self.chkBlockDwell = self.gui.findChild("QCheckBox", "checkBoxBlockDwell")
        self.chkEstateSkipScripts = self.gui.findChild("QCheckBox", "checkBoxEstateSkipScripts")
        self.chkResetHomeOnTeleport = self.gui.findChild("QCheckBox", "checkBoxResetHomeOnTeleport")
        self.chkTaxFree = self.gui.findChild("QCheckBox", "checkBoxTaxFree")
        self.chkDenyAgeUnverified = self.gui.findChild("QCheckBox", "checkBoxDenyAgeUnverified")



        self.btnLoadEstate.connect("clicked(bool)", self.btnLoadEstateClicked)
        
        self.btnToBan = self.gui.findChild("QPushButton", "pushButtonToBan")
        self.btnToAccess = self.gui.findChild("QPushButton", "pushButtonToAccess")
        self.btnToManagers = self.gui.findChild("QPushButton", "pushButtonToManagers")
        self.btnSaveUserInfo = self.gui.findChild("QPushButton", "pushButtonSaveUserInfo")
        
        self.btnRemoveBan = self.gui.findChild("QPushButton", "pushButtonRemoveBan")
        self.btnRemoveAccess = self.gui.findChild("QPushButton", "pushButtonRemoveAccess")
        self.btnRemoveManagers = self.gui.findChild("QPushButton", "pushButtonRemoveManager")        
        self.btnRemoveSaved = self.gui.findChild("QPushButton", "pushButtonRemoveSaved")
        
        self.btnSavedToAccess = self.gui.findChild("QPushButton", "pushButtonSavedToAccess")
        self.btnSavedToBan = self.gui.findChild("QPushButton", "pushButtonSavedToBan")
        self.btnSavedToManagers = self.gui.findChild("QPushButton", "pushButtonSavedToManagers")
        
        self.btnKick = self.gui.findChild("QPushButton", "pushButtonKick")
        self.btnRequestGodLikePowers = self.gui.findChild("QPushButton", "pushButtonRequestGodLikePowers")
        self.lineKickMessage = self.gui.findChild("QLineEdit","lineEditKickMessage")
        
        
        self.btnToBan.connect("clicked(bool)", self.btnToBanClicked)
        self.btnToAccess.connect("clicked(bool)", self.btnToAccessClicked)
        self.btnToManagers.connect("clicked(bool)", self.btnToManagersClicked)
        self.btnSaveUserInfo.connect("clicked(bool)", self.btnSaveUserInfoClicked)

        self.btnRemoveBan.connect("clicked(bool)", self.btnRemoveBanClicked)
        self.btnRemoveAccess.connect("clicked(bool)", self.btnRemoveAccessClicked)
        self.btnRemoveManagers.connect("clicked(bool)", self.btnRemoveManagersClicked)
        
        self.btnRemoveSaved.connect("clicked(bool)", self.btnRemoveSavedClicked)

        self.btnSavedToAccess.connect("clicked(bool)", self.btnSavedToAccessClicked)
        self.btnSavedToBan.connect("clicked(bool)", self.btnSavedToBanClicked)
        self.btnSavedToManagers.connect("clicked(bool)", self.btnSavedToManagersClicked)
        
        self.btnRequestGodLikePowers.connect("clicked(bool)", self.btnRequestGodLikePowersClicked)
        self.btnKick.connect("clicked(bool)", self.btnKickClicked)

        self.chkEstateAccess.connect("toggled(bool)", self.chkEstateAccessToggled)        
{'fraction_non_alphanumeric': 0.10531711317659924, 'fraction_numerical': 0.0008201202843083652, 'mean_word_length': 2.849776374638253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7544592', 'n_tokens_mistral': 4364, 'n_tokens_neox': 4267, 'n_words': 584}