예제 #1
0
 def __init__(self, parent, fieldsavailable):
     wx.Dialog.__init__(self, parent)
     self.fields2hash = []
     MainFrame.fields2hash = []
     choices = fieldsavailable.replace('\n', ',')
     if _inputseparator != ',':
         choices = choices.replace(_inputseparator, ',')
     choices = choices.replace('"', '')
     choices = choices.rstrip(',')
     choices = choices.split(',')
     choices = set(choices)
     choices = list(choices)
     sizer = wx.BoxSizer(wx.VERTICAL)
     self.ip = ItemsPicker(self, -1, choices, 'Available Fields:', 'Selected Fields:',
                           IP_SORT_CHOICES | IP_SORT_SELECTED)
     self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.onselectionchange)
     self.ip.SetMinSize((-1, 150))
     sizer.Add(self.ip, 0, wx.ALL, 10)
     b = wx.Button(self, -1, "Click after finishing field selection(s)", style=wx.NO_BORDER)
     b.SetToolTip(
         'The information in the lists above should represent field names. If not, then your input file is not in '
         'the correct format.')
     b.Bind(wx.EVT_BUTTON, self.onfinished)
     sizer.Add(b, 0, wx.ALL | wx.CENTER, 5)
     self.SetSizer(sizer)
     self.Fit()
예제 #2
0
    def __init__(self, parent, names):
        wx.Dialog.__init__(self, parent, -1, L('BUTTON_ORDER_AND_FILTER'))
        self.parent = parent
        self.names = names

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.ip = ItemsPicker(self,
                              -1,
                              names,
                              L('PICKER_EXISTING'),
                              L('PICKER_FILTERED'),
                              ipStyle=0)
        self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.on_selection_change)
        self.ip._source.SetMinSize((-1, 150))
        sizer.Add(self.ip, 1, wx.ALL, 10)

        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
        cancel = wx.Button(self, label=L('NEW_PROJECT_CANCEL'))
        cancel.Bind(wx.EVT_BUTTON, self.on_cancel)

        self.create = wx.Button(self, label=L('NOW_SHOW'))
        self.create.Bind(wx.EVT_BUTTON, self.on_ok)
        self.create.Disable()

        sizer_button.Add(cancel)
        sizer_button.Add(self.create)

        sizer.Add(sizer_button, 0, wx.ALL, 10)

        self.SetSizer(sizer)
        self.itemCount = 3
        self.Fit()
        self.ShowModal()
 def __init__(self, parent, style, log):
     wx.Dialog.__init__(self, parent, title='Pick some items...',
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
     self.log = log
     sizer = wx.BoxSizer(wx.VERTICAL)
     b = wx.Button(self, -1, "Add Item")
     b.Bind(wx.EVT_BUTTON, self.OnAdd)
     sizer.Add(b, 0, wx.ALL, 5)
     self.ip = ItemsPicker(self, -1, choices=['ThisIsItem3', 'ThisIsItem6',
                                              'ThisIsItem2', 'ThisIsItem5',
                                              'ThisIsItem1', 'ThisIsItem4'],
                           label='Stuff:', selectedLabel='Selected stuff:',
                           ipStyle=style)
     self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
     self.ip._source.SetMinSize((-1, 150))
     bmp2 = wx.Bitmap(gBmpDir + os.sep + "bp_btn2.png", wx.BITMAP_TYPE_PNG)
     self.ip.bAdd.SetBitmap(bmp2, dir=wx.RIGHT)
     self.ip.bAdd.SetLabel('Add')
     bmp1 = wx.Bitmap(gBmpDir + os.sep + "bp_btn1.png", wx.BITMAP_TYPE_PNG)
     self.ip.bRemove.SetBitmap(bmp1, dir=wx.LEFT)
     self.ip.bRemove.SetLabel('Remove')
     sizer.Add(self.ip, 1, wx.EXPAND | wx.ALL, 10)
     self.SetSizer(sizer)
     self.itemCount = 3
     self.Fit()
     self.SetMinSize(self.GetSize())
예제 #4
0
    def __init__(self, parent, style=IP_REMOVE_FROM_CHOICES):
        wx.Panel.__init__(self, parent, style=style)
        self.backupList = GL.backup_list
        self.radioList = [u'当前用户最近备份列表', u'载入当前用户备份列表', u'载入全局备份列表']
        self.backupRadio = wx.RadioBox(self, -1, "", (-1, -1), wx.DefaultSize,
                                       self.radioList, 3,
                                       wx.RA_SPECIFY_COLS | wx.NO_BORDER)
        #BtnRollBack = wx.Button(self,label=u"锟斤拷原",size=(80,50),id=GL.Publishing)
        self.BakRollText = ItemsPicker(self,
                                       -1,
                                       self.backupList,
                                       u"备份列表",
                                       u'确认还原文件:',
                                       ipStyle=style)
        self.BakRollText.add_button_label = u'添加=》'
        self.BakRollText.remove_button_label = u'《=移除'
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        vsizer = wx.BoxSizer(wx.VERTICAL)
        self.BakRollText._source.SetMinSize((-1, 150))

        self.BakRollText._dest.SetMinSize((-1, 150))
        vsizer.Add(self.backupRadio, 0, wx.ALL, 0)
        vsizer.Add(self.BakRollText, 1, wx.ALL | wx.EXPAND, 0)
        hsizer.Add(vsizer, 1, wx.ALL | wx.EXPAND, 10)
        self.SetSizerAndFit(hsizer)
        self.itemCount = 3
        self.Bind(wx.EVT_RADIOBOX, self.OnLoadBackupList, self.backupRadio)
        self.BakRollText.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
예제 #5
0
class ItemsPickerDialog(wx.Dialog):
    def __init__(self,parent, style, log):
        wx.Dialog.__init__(self,parent)
        self.log = log
        sizer = wx.BoxSizer(wx.VERTICAL)
        b = wx.Button(self, -1, "Add Item")
        b.Bind(wx.EVT_BUTTON, self.OnAdd)
        sizer.Add(b, 0, wx.ALL, 5)
        self.ip = ItemsPicker(self,-1,
                          ['ThisIsItem3','ThisIsItem2','ThisIsItem1'],
                          'Stuff:', 'Selected stuff:',ipStyle = style)
        self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
        self.ip._source.SetMinSize((-1,150))
        self.ip.bAdd.SetBitmap(_bp_btn2.GetBitmap(), dir=wx.RIGHT)
        self.ip.bAdd.SetLabel('Add')
        self.ip.bRemove.SetBitmap(_bp_btn1.GetBitmap(), dir=wx.LEFT)
        self.ip.bRemove.SetLabel('Remove')
        sizer.Add(self.ip, 0, wx.ALL, 10)
        self.SetSizer(sizer)
        self.itemCount = 3
        self.Fit()

    def OnAdd(self,e):
        items = self.ip.GetItems()
        self.itemCount += 1
        newItem = "item%d" % self.itemCount
        self.ip.SetItems(items + [newItem])

    def OnSelectionChange(self, e):
        self.log.write("EVT_IP_SELECTION_CHANGED %s\n" % \
                        ",".join(e.GetItems()))
예제 #6
0
class ItemsPickerDialog(wx.Dialog):
    def __init__(self, parent: wx.Window, available: List[str],
                 chosen: List[str], ipStyle):
        super().__init__(parent=parent,
                         title="Project membership",
                         style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.ip = ItemsPicker(self,
                              choices=available,
                              label='Available projects',
                              selectedLabel='Member of project:',
                              ipStyle=ipStyle)
        self.ip.SetSelections(chosen)
        #self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
        self.ip._source.SetMinSize((-1, 150))

        sizer.Add(self.ip, 0, wx.ALL, 10)

        bsizer = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)
        sizer.Add(bsizer, flag=wx.EXPAND | wx.ALL, border=5)

        self.SetSizerAndFit(sizer)

    def GetSelections(self):
        return self.ip.GetSelections()

    def GetItems(self):
        return self.ip.GetItems()
예제 #7
0
    def __init__(self, parent, style):
        wx.Dialog.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)
        b = wx.Button(self, -1, "Add Item")
        b.Bind(wx.EVT_BUTTON, self.OnAdd)
        sizer.Add(b, 0, wx.ALL, 5)
        self.ip = ItemsPicker(self,
                              -1,
                              ['ThisIsItem3', 'ThisIsItem2', 'ThisIsItem1'],
                              'Stuff:',
                              'Selected stuff:',
                              ipStyle=style)
        self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
        self.ip._source.SetMinSize((-1, 150))

        # Customize the buttons for this example.
        if 'wxMac' not in wx.PlatformInfo:
            # NOTE: wx.Button on OSX does not modify the button size when adding a
            # bitmap after the fact like this, and these bitmaps are a little too
            # large and look funny in OSX, so we won't do this customization there.
            self.ip.bAdd.SetLabel('Add')
            self.ip.bRemove.SetLabel('Remove')

        sizer.Add(self.ip, 0, wx.ALL, 10)
        self.SetSizer(sizer)
        self.itemCount = 3
        self.Fit()
예제 #8
0
    def __init__(self, parent, results, views_names):
        wx.Panel.__init__(self, parent, -1, size=(300, 200))
        self.parent = parent
        self.error_name = True
        self.error_result = True
        self.views_names = views_names
        # self.I = I

        self.bmp_alert = wx.StaticBitmap(self)
        self.bmp_alert.SetBitmap(execute_bit.GetBitmap())
        font_description = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
        font_description.SetPointSize(9)
        self.label_alert = wx.StaticText(self)
        self.label_alert.SetFont(font_description)
        self.label_alert.SetLabel(L('VIEW_ALERT_NAME'))

        label_name = wx.StaticText(self, label=L('VIEW_NAME'))
        self.name = wx.TextCtrl(self)

        label_results = wx.StaticText(self, label=L('VIEW_ALERT_RESULTS'))
        static_result = wx.StaticLine(self, -1)

        ip = ItemsPicker(self,
                         -1,
                         results,
                         L('VIEW_OPTION_RESULTS'),
                         L('VIEW_RESULTS_SELECTED'),
                         ipStyle=IP_SORT_CHOICES | IP_SORT_SELECTED
                         | IP_REMOVE_FROM_CHOICES)
        ip._source.SetMinSize((50, 100))
        parent.ip = ip

        # Create the sizers
        topSizer = wx.BoxSizer(wx.VERTICAL)
        alert_sizer = wx.BoxSizer(wx.HORIZONTAL)
        alert_sizer.Add(self.bmp_alert, flag=wx.ALIGN_LEFT)
        alert_sizer.Add(self.label_alert, flag=wx.ALIGN_LEFT)

        name_sizer = wx.BoxSizer(wx.HORIZONTAL)
        name_sizer.Add(label_name, 0)
        name_sizer.Add(self.name, 1, wx.EXPAND)
        result_sizer = wx.BoxSizer(wx.VERTICAL)
        result_sizer.Add(label_results, 0, wx.ALIGN_CENTER)
        result_sizer.Add(static_result, 0, wx.ALIGN_CENTER | wx.EXPAND)
        topSizer.Add(alert_sizer, 0, wx.EXPAND)
        topSizer.Add(name_sizer, 0, wx.EXPAND)
        topSizer.Add(result_sizer, 0, wx.ALIGN_CENTER | wx.TOP, 15)
        topSizer.Add(ip, 1, wx.EXPAND)
        self.SetSizer(topSizer)

        self.name.SetFocus()
        self.name.Bind(wx.EVT_KEY_UP, self.on_key_up)
        ip.Bind(EVT_IP_SELECTION_CHANGED, self.on_selected)
        self._disable()
class FieldsPickerDialog(wx.Dialog):
    """
    Present to user all fields available from the input file(s) selected in previous step that may
    be selected for hashing. Allow user to select desired fields/columns.
    """
    def __init__(self, parent, fieldsavailable):
        wx.Dialog.__init__(self, parent)
        self.fields2hash = []
        MainFrame.fields2hash = []
        choices = fieldsavailable.replace('\n', ',')
        choices = choices.replace('"', '')
        choices = choices.rstrip(',')
        choices = choices.split(',')
        choices = set(choices)
        choices = list(choices)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.ip = ItemsPicker(self, -1, choices, 'Available Columns:',
                              'Selected Columns:',
                              IP_SORT_CHOICES | IP_SORT_SELECTED)
        self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.onselectionchange)
        self.ip.SetMinSize((-1, 150))
        sizer.Add(self.ip, 0, wx.ALL, 10)
        b = wx.Button(self,
                      -1,
                      "Click after finishing column selection(s)",
                      style=wx.NO_BORDER)
        b.SetToolTip(
            'The information in the lists above should represent column names. If not, then your input data is not '
            'in the correct format. The selected sheet should contain the column names in the first row.'
        )
        b.Bind(wx.EVT_BUTTON, self.onfinished)
        sizer.Add(b, 0, wx.ALL | wx.CENTER, 5)
        self.SetSizer(sizer)
        self.Fit()

    def onfinished(self, e):
        """ Once user clicks 'finished' button create list of fields to be hashed.

        :param e: Event
        :return: Fields to be hashed: fields2hash

        """
        if len(self.fields2hash) != 0:
            MainFrame.fields2hash = self.fields2hash.split(',')
        self.Close()

    def onselectionchange(self, e):
        """ Logic for identifying and selecting fields to be hashed.

        :param e: Event
        :return: Internal list of fields selected.
        """
        self.items = ",".join(e.GetItems())
        self.fields2hash = self.items
예제 #10
0
 def __init__(self, parent, style, log):
     wx.Dialog.__init__(self, parent)
     self.log = log
     sizer = wx.BoxSizer(wx.VERTICAL)
     b = wx.Button(self, -1, "Add Item")
     b.Bind(wx.EVT_BUTTON, self.OnAdd)
     sizer.Add(b, 0, wx.ALL, 5)
     self.ip = ItemsPicker(self,
                           -1,
                           ['ThisIsItem3', 'ThisIsItem2', 'ThisIsItem1'],
                           'Stuff:',
                           'Selected stuff:',
                           ipStyle=style)
     self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
     self.ip._source.SetMinSize((-1, 150))
     sizer.Add(self.ip, 0, wx.ALL, 10)
     self.SetSizer(sizer)
     self.itemCount = 3
     self.Fit()
예제 #11
0
class ItemsPickerDialog(wx.Dialog):
    def __init__(self,parent, style, log):
        wx.Dialog.__init__(self,parent)
        self.log = log
        sizer = wx.BoxSizer(wx.VERTICAL)
        b = wx.Button(self, -1, "Add Item")
        b.Bind(wx.EVT_BUTTON, self.OnAdd)
        sizer.Add(b, 0, wx.ALL, 5)
        self.ip = ItemsPicker(self,-1,
                          ['ThisIsItem3','ThisIsItem2','ThisIsItem1'],
                          'Stuff:', 'Selected stuff:',ipStyle = style)
        self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
        self.ip._source.SetMinSize((-1,150))

        # Customize the buttons for this example.
        if 'wxMac' not in wx.PlatformInfo:
            # NOTE: wx.Button on OSX does not modify the button size when adding a
            # bitmap after the fact like this, and these bitmaps are a little too
            # large and look funny in OSX, so we won't do this customization there.
            self.ip.bAdd.SetBitmap(_bp_btn2.GetBitmap(), dir=wx.RIGHT)
            self.ip.bAdd.SetLabel('Add')
            self.ip.bRemove.SetBitmap(_bp_btn1.GetBitmap(), dir=wx.LEFT)
            self.ip.bRemove.SetLabel('Remove')

        sizer.Add(self.ip, 0, wx.ALL, 10)
        self.SetSizer(sizer)
        self.itemCount = 3
        self.Fit()


    def OnAdd(self,e):
        items = self.ip.GetItems()
        self.itemCount += 1
        newItem = "item%d" % self.itemCount
        self.ip.SetItems(items + [newItem])


    def OnSelectionChange(self, e):
        self.log.write("EVT_IP_SELECTION_CHANGED %s\n" % \
                        ",".join(e.GetItems()))
예제 #12
0
    def init_ui(self):
        sizer = wx.BoxSizer(wx.VERTICAL)

        # titulo
        title_sizer = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, label='Ordenando Bloques')
        title_line = wx.StaticLine(self)
        title_sizer.Add(title, 0, wx.CENTER | wx.TOP, 10)
        title_sizer.Add(title_line, 0, wx.EXPAND | wx.RIGHT | wx.LEFT, 5)

        self.i_picker = ItemsPicker(self, -1, self.names, 'Orden actual',
                                    'Nuevo Orden')

        # buttons confirmar, cancelar
        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
        sizer_cancel = wx.BoxSizer()
        self.cancel = wx.Button(self, -1, 'Cancelar')
        self.cancel.SetDefault()
        sizer_cancel.Add(self.cancel)
        sizer_apply = wx.BoxSizer()
        self.apply = wx.Button(self, -1, 'Aplicar')
        sizer_apply.Add(self.apply, 0, wx.ALIGN_RIGHT)
        self.apply.Disable()

        sizer_button.Add(sizer_cancel, 0, wx.ALL, 5)
        sizer_button.Add(sizer_apply, 0, wx.ALL, 5)

        sizer.Add(title_sizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        sizer.Add(self.i_picker, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(sizer_button, 0, wx.EXPAND | wx.LEFT, 100)

        self.i_picker.Bind(EVT_IP_SELECTION_CHANGED, self.check_up)
        self.Bind(wx.EVT_BUTTON, self.on_button_apply, self.apply)
        self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.cancel)
        self.Bind(wx.EVT_CHAR, self.on_key_escape)

        self.SetSizer(sizer)
예제 #13
0
    def settingsbox(self, event):
        # Settings dialog
        settingsdialog = wx.Dialog(wx.GetApp().TopWindow, wx.ID_ANY,
                                   "Settings")

        boxsizer = wx.BoxSizer(wx.VERTICAL)

        normallist = (
            'a-0001.a-msedge.net', 'a-0002.a-msedge.net',
            'a-0003.a-msedge.net', 'a-0004.a-msedge.net',
            'a-0005.a-msedge.net', 'a-0006.a-msedge.net',
            'a-0007.a-msedge.net', 'a-0008.a-msedge.net',
            'a-0009.a-msedge.net', 'a-msedge.net', 'a.ads1.msn.com',
            'a.ads2.msads.net', 'a.ads2.msn.com', 'a.rad.msn.com',
            'ac3.msn.com', 'ad.doubleclick.net', 'adnexus.net', 'adnxs.com',
            'ads.msn.com', 'ads1.msads.net', 'ads1.msn.com', 'aidps.atdmt.com',
            'aka-cdn-ns.adtech.de', 'az361816.vo.msecnd.net',
            'az512334.vo.msecnd.net', 'b.ads1.msn.com', 'b.ads2.msads.net',
            'b.rad.msn.com', 'bs.serving-sys.com', 'c.atdmt.com', 'c.msn.com',
            'cdn.atdmt.com', 'cds26.ams9.msecn.net', 'choice.microsoft.com',
            'choice.microsoft.com.nsatc.net', 'compatexchange.cloudapp.net',
            'corp.sts.microsoft.com', 'corpext.msitadfs.glbdns2.microsoft.com',
            'cs1.wpc.v0cdn.net', 'db3aqu.atdmt.com',
            'df.telemetry.microsoft.com', 'diagnostics.support.microsoft.com',
            'ec.atdmt.com', 'feedback.microsoft-hohm.com',
            'feedback.search.microsoft.com', 'feedback.windows.com',
            'flex.msn.com', 'g.msn.com', 'h1.msn.com',
            'i1.services.social.microsoft.com',
            'i1.services.social.microsoft.com.nsatc.net',
            'lb1.www.ms.akadns.net', 'live.rads.msn.com', 'm.adnxs.com',
            'msedge.net', 'msftncsi.com', 'msnbot-65-55-108-23.search.msn.com',
            'msntest.serving-sys.com', 'oca.telemetry.microsoft.com',
            'oca.telemetry.microsoft.com.nsatc.net',
            'pre.footprintpredict.com', 'preview.msn.com', 'rad.live.com',
            'rad.msn.com', 'redir.metaservices.microsoft.com',
            'schemas.microsoft.akadns.net ', 'secure.adnxs.com',
            'secure.flashtalking.com', 'settings-sandbox.data.microsoft.com',
            'settings-win.data.microsoft.com',
            'sls.update.microsoft.com.akadns.net',
            'sqm.df.telemetry.microsoft.com', 'sqm.telemetry.microsoft.com',
            'sqm.telemetry.microsoft.com.nsatc.net', 'static.2mdn.net',
            'statsfe1.ws.microsoft.com', 'statsfe2.ws.microsoft.com',
            'telecommand.telemetry.microsoft.com',
            'telecommand.telemetry.microsoft.com.nsatc.net',
            'telemetry.appex.bing.net', 'telemetry.microsoft.com',
            'telemetry.urs.microsoft.com',
            'vortex-bn2.metron.live.com.nsatc.net',
            'vortex-cy2.metron.live.com.nsatc.net',
            'vortex-sandbox.data.microsoft.com',
            'vortex-win.data.microsoft.com', 'vortex.data.microsoft.com',
            'watson.live.com', 'www.msftncsi.com', 'ssw.live.com',
            'reports.wes.df.telemetry.microsoft.com',
            'services.wes.df.telemetry.microsoft.com',
            'web.vortex.data.microsoft.com',
            'vortex-win.data.metron.live.com.nsatc.net',
            'v10.vortex-win.data.microsoft.com',
            'vortex-cy2.metron.live.com.nsatc.net',
            'vortex.data.glbdns2.microsoft.com',
            'vortex-win.data.microsoft.com', 'vortex.data.microsoft.com')

        extralist = ('fe2.update.microsoft.com.akadns.net', 's0.2mdn.net',
                     'statsfe2.update.microsoft.com.akadns.net',
                     'survey.watson.microsoft.com', 'view.atdmt.com',
                     'watson.microsoft.com',
                     'watson.ppe.telemetry.microsoft.com',
                     'watson.telemetry.microsoft.com',
                     'watson.telemetry.microsoft.com.nsatc.net',
                     'wes.df.telemetry.microsoft.com', 'ui.skype.com',
                     'pricelist.skype.com', 'apps.skype.com', 'm.hotmail.com',
                     's.gateway.messenger.live.com')

        self.normalpicker = ItemsPicker(settingsdialog,
                                        id=wx.ID_ANY,
                                        choices=[],
                                        selectedLabel="Domains to be blocked",
                                        ipStyle=IP_SORT_SELECTED
                                        | IP_SORT_CHOICES
                                        | IP_REMOVE_FROM_CHOICES)
        self.normalpicker.SetSelections(normallist)

        self.extrapicker = ItemsPicker(
            settingsdialog,
            id=wx.ID_ANY,
            choices=[],
            selectedLabel="Extra domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        self.extrapicker.SetSelections(extralist)

        iplist = ('2.22.61.43', '2.22.61.66', '65.39.117.230', '65.55.108.23',
                  '23.218.212.69', '134.170.30.202', '137.116.81.24',
                  '157.56.106.189', '204.79.197.200', '65.52.108.33',
                  '64.4.54.254')

        self.ippicker = ItemsPicker(settingsdialog,
                                    id=wx.ID_ANY,
                                    choices=[],
                                    selectedLabel="IP addresses to be blocked",
                                    ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
                                    | IP_REMOVE_FROM_CHOICES)

        self.ippicker.SetToolTip(wx.ToolTip("Hello"))

        self.ippicker.SetSelections(iplist)

        boxsizer.Add(self.normalpicker, 0, wx.ALL | wx.TOP, 10)
        boxsizer.Add(self.extrapicker, 0, wx.ALL | wx.CENTER | wx.EXPAND, 10)
        boxsizer.Add(self.ippicker, 0, wx.ALL | wx.BOTTOM | wx.EXPAND, 10)

        settingsdialog.SetSizerAndFit(boxsizer)

        if event is not None:
            settingsdialog.Center()
            settingsdialog.ShowModal()
예제 #14
0
class BackupRollBackUI(wx.Panel):
    def __init__(self, parent, style=IP_REMOVE_FROM_CHOICES):
        wx.Panel.__init__(self, parent, style=style)
        self.backupList = GL.backup_list
        self.radioList = [u'当前用户最近备份列表', u'载入当前用户备份列表', u'载入全局备份列表']
        self.backupRadio = wx.RadioBox(self, -1, "", (-1, -1), wx.DefaultSize,
                                       self.radioList, 3,
                                       wx.RA_SPECIFY_COLS | wx.NO_BORDER)
        #BtnRollBack = wx.Button(self,label=u"锟斤拷原",size=(80,50),id=GL.Publishing)
        self.BakRollText = ItemsPicker(self,
                                       -1,
                                       self.backupList,
                                       u"备份列表",
                                       u'确认还原文件:',
                                       ipStyle=style)
        self.BakRollText.add_button_label = u'添加=》'
        self.BakRollText.remove_button_label = u'《=移除'
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        vsizer = wx.BoxSizer(wx.VERTICAL)
        self.BakRollText._source.SetMinSize((-1, 150))

        self.BakRollText._dest.SetMinSize((-1, 150))
        vsizer.Add(self.backupRadio, 0, wx.ALL, 0)
        vsizer.Add(self.BakRollText, 1, wx.ALL | wx.EXPAND, 0)
        hsizer.Add(vsizer, 1, wx.ALL | wx.EXPAND, 10)
        self.SetSizerAndFit(hsizer)
        self.itemCount = 3
        self.Bind(wx.EVT_RADIOBOX, self.OnLoadBackupList, self.backupRadio)
        self.BakRollText.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)

    def OnLoadBackupList(self, event):
        if event.GetInt() == 0:
            self.BakRollText._source.SetItems([])
            self.BakRollText._source.SetItems(GL.backup_list)
            #self.BakRollText._dest.SetItems(GL.backup_list)
            #print self.BakRollText._dest.GetItems()
        elif event.GetInt() == 1:
            self.BakRollText._source.SetItems([])
            import codecs

            #data = self.GetUserLogList('f:\\backup\\Glogs\\global_backup.log')
            #print data
            #self.FileContentList = []
            self.FileContentList = self.GetUserLogList(
                GL.global_backup_logfile, isFilter=True)
            #with codecs.open('f:\\backup\\Glogs\\global_backup.log','r',"utf8") as FileObj:
            #    [self.FileContentList.append(line) for line in FileObj]
            #print self.FileContentList

            self.BakRollText._source.SetItems(self.FileContentList)
            #self.BakRollText._source.SetBackgroundColour('#FF0000')
            #print "load log2"
        elif event.GetInt() == 2:
            self.BakRollText._source.SetItems([])
            self.FileContentList = self.GetUserLogList(
                GL.global_backup_logfile, isFilter=False)
            self.BakRollText._source.SetItems(self.FileContentList)
        else:
            self.BakRollText._source.SetItems([])

    def GetUserLogList(self, filelog, isFilter):
        if not os.path.exists(filelog):
            msg = u"读取全局日志文件出错."
            LoadLog.LogMsg(GL.logger_sysLog.error, msg)
            wx.MessageBox(msg, u"错误", style=wx.OK | wx.ICON_ERROR)
            FileContentList = []
            return FileContentList
        FileContentList = []
        with open(filelog, 'r') as f:
            if isFilter is True:
                bad = 0
                import codecs, re
                goodline = re.compile(ur'#+?.*\[%s\].*#$' % GL.SvnUser)
                badline = re.compile(ur'#+?.*\[((?!%s).)*#$' % GL.SvnUser)
                for line in f:
                    line = unicode(line, "utf8")
                    if goodline.search(line) is not None:
                        #print line
                        bad = 1
                        FileContentList.append(line.strip())
                        continue
                    if bad and badline.search(line) is None:
                        #print line
                        FileContentList.append(line.strip())
                        continue
                    else:
                        bad = 0
            else:
                [FileContentList.append(unicode(line, "utf8")) for line in f]
        return FileContentList

    def OnAdd(self, e):
        items = self.BakRollText.GetItems()
        self.itemCount += 1
        newItem = "item%d" % self.itemCount
        self.BakRollText.SetItems(items + [newItem])

    #def OnSelectionChange(self, e):
    # self.log.write("EVT_IP_SELECTION_CHANGED %s\n" % \
    # ",".join(e.GetItems()))
    def OnSelectionChange(self, e):
        #self.log.write("EVT_IP_SELECTION_CHANGED %s\n" % ",".join(e.GetItems()))
        pass
예제 #15
0
class BlockSorted(wx.Dialog):
    def __init__(self, parent, _names):
        wx.Dialog.__init__(self,
                           parent,
                           size=(400, 300),
                           title='Ordenar Bloques')
        self.parent = parent
        self.names = _names
        self.init_ui()

        # ------ Definiciones iniciales -----

        self.Centre(wx.BOTH)
        self.CenterOnScreen()
        self.ShowModal()

    def init_ui(self):
        sizer = wx.BoxSizer(wx.VERTICAL)

        # titulo
        title_sizer = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, label='Ordenando Bloques')
        title_line = wx.StaticLine(self)
        title_sizer.Add(title, 0, wx.CENTER | wx.TOP, 10)
        title_sizer.Add(title_line, 0, wx.EXPAND | wx.RIGHT | wx.LEFT, 5)

        self.i_picker = ItemsPicker(self, -1, self.names, 'Orden actual',
                                    'Nuevo Orden')

        # buttons confirmar, cancelar
        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
        sizer_cancel = wx.BoxSizer()
        self.cancel = wx.Button(self, -1, 'Cancelar')
        self.cancel.SetDefault()
        sizer_cancel.Add(self.cancel)
        sizer_apply = wx.BoxSizer()
        self.apply = wx.Button(self, -1, 'Aplicar')
        sizer_apply.Add(self.apply, 0, wx.ALIGN_RIGHT)
        self.apply.Disable()

        sizer_button.Add(sizer_cancel, 0, wx.ALL, 5)
        sizer_button.Add(sizer_apply, 0, wx.ALL, 5)

        sizer.Add(title_sizer, 0, wx.EXPAND | wx.BOTTOM, 10)
        sizer.Add(self.i_picker, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add(sizer_button, 0, wx.EXPAND | wx.LEFT, 100)

        self.i_picker.Bind(EVT_IP_SELECTION_CHANGED, self.check_up)
        self.Bind(wx.EVT_BUTTON, self.on_button_apply, self.apply)
        self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.cancel)
        self.Bind(wx.EVT_CHAR, self.on_key_escape)

        self.SetSizer(sizer)

    def check_up(self, event):

        if len(self.names) != len(self.i_picker.GetSelections()):
            self.apply.Disable()
            self.cancel.SetDefault()
            return None

        _names = [str(i) for i in self.i_picker.GetSelections()]
        if self.names == _names:
            self.apply.Disable()
            self.cancel.SetDefault()
            return None

        self.apply.Enable()
        self.apply.SetDefault()

    def on_button_cancel(self, event):
        self.Close()

    def on_button_apply(self, event):
        order = [str(i) for i in self.i_picker.GetSelections()]
        new_order = []
        for name in self.names:
            new_order.append(order.index(name))
        self.parent.sort_blocks(new_order)
        self.Close()

    def on_key_escape(self, event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            self.Close()
예제 #16
0
class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,
                          parent=None,
                          title='Disable Windows 10 Tracking',
                          size=[375, 345],
                          style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER
                          ^ wx.MAXIMIZE_BOX)

        panel = wx.Panel(self)  # Frame panel

        # Test for elevation
        if ctypes.windll.shell32.IsUserAnAdmin() != 0:
            warn = wx.MessageDialog(
                parent=self,
                message=
                "Program requires elevation, please run it as an administrator",
                caption="ERROR",
                style=wx.OK | wx.ICON_WARNING)
            warn.ShowModal()
            sys.exit()

        # Get icon
        shell32file = os.path.join(os.environ['SYSTEMROOT'],
                                   'System32\\shell32.dll')
        self.SetIcon(wx.Icon(shell32file + ";315", wx.BITMAP_TYPE_ICO))

        # Info bar w/ about menu
        menu = wx.Menu()
        aboutitem = menu.Append(wx.ID_ABOUT, "About", "About the application")
        optionsitem = menu.Append(wx.ID_ANY, "Options",
                                  "Settings for the application")

        menubar = wx.MenuBar()
        menubar.Append(menu, "&Menu")

        self.SetMenuBar(menubar)
        self.Bind(wx.EVT_MENU, self.aboutbox, aboutitem)
        self.Bind(wx.EVT_MENU, self.settingsbox, optionsitem)

        # Service checkbox
        self.servicebox = wx.CheckBox(panel, label="&Services", pos=(10, 10))
        self.servicebox.SetToolTip(
            wx.ToolTip(
                "Disables or Deletes tracking services. Choose option in Service Method"
            ))
        self.Bind(wx.EVT_CHECKBOX, self.serviceradioboxcheck, self.servicebox)

        # DiagTrack checkbox
        self.diagtrackbox = wx.CheckBox(panel,
                                        label="Clear &DiagTrack log",
                                        pos=(10, 25))
        self.diagtrackbox.SetToolTip(
            wx.ToolTip(
                "Clears Diagnostic Tracking log and prevents modification to it. "
                "This cannot be undone without doing it manually."))

        # Telemetry checkbox
        self.telemetrybox = wx.CheckBox(panel,
                                        label="&Telemetry",
                                        pos=(10, 40))
        self.telemetrybox.SetToolTip(
            wx.ToolTip(
                "Sets \'AllowTelemetry\' to 0. On non-Enterprise OS editions, requires HOSTS file modification"
            ))
        self.Bind(wx.EVT_CHECKBOX, self.telemetryhostcheck, self.telemetrybox)

        # HOSTS file checkbox
        self.hostbox = wx.CheckBox(panel,
                                   label="&Block tracking domains",
                                   pos=(10, 55))
        self.hostbox.SetToolTip(
            wx.ToolTip(
                "Add known tracking domains to HOSTS file. Required to disable Telemetry"
            ))

        # Extra HOSTS checkbox
        self.extrahostbox = wx.CheckBox(
            panel, label="Block &even more tracking domains", pos=(10, 70))
        self.extrahostbox.SetToolTip(
            wx.ToolTip(
                "For the paranoid. Adds extra domains to the HOSTS file. \
                                                May disable Skype, Dr. Watson, Hotmail and/or Error Reporting"
            ))
        self.Bind(wx.EVT_CHECKBOX, self.extrahosthostcheck, self.extrahostbox)

        # IP block checkbox
        self.ipbox = wx.CheckBox(panel,
                                 label="Block tracking &IP addresses",
                                 pos=(10, 85))
        self.ipbox.SetToolTip(
            wx.ToolTip(
                "Blocks known tracking IP addresses with Windows Firewall."))

        # Windows Privacy Regs (Policy Manager)
        self.wdwsbox = wx.CheckBox(
            panel,
            label="Windows Defender/WifiSense data collection",
            pos=(10, 100))
        self.wdwsbox.SetToolTip(
            wx.ToolTip(
                "Modifies registry to prevent Defender/WifiSense data collection"
            ))

        # OneDrive uninstall checkbox
        self.onedrivedbox = wx.CheckBox(panel,
                                        label="Uninstall &OneDrive",
                                        pos=(10, 115))
        self.onedrivedbox.SetToolTip(
            wx.ToolTip(
                "Uninstalls OneDrive from your computer and removes it from Explorer."
            ))

        # App static box
        self.appbox = wx.StaticBox(panel,
                                   label="Built-in Apps",
                                   pos=(10, 130),
                                   size=(351, 160))

        self.builderbox = wx.CheckBox(self.appbox,
                                      label="&3D Builder",
                                      pos=(10, 15))
        self.calmailbox = wx.CheckBox(self.appbox,
                                      label="C&alender && Mail",
                                      pos=(10, 30))
        self.camerabox = wx.CheckBox(self.appbox,
                                     label="&Camera",
                                     pos=(10, 45))
        self.officebox = wx.CheckBox(self.appbox,
                                     label="Get &Office App",
                                     pos=(10, 60))
        self.skypebox = wx.CheckBox(self.appbox,
                                    label="Get S&kype App",
                                    pos=(10, 75))
        self.startbox = wx.CheckBox(self.appbox,
                                    label="Get S&tarted App",
                                    pos=(10, 90))
        self.groovebox = wx.CheckBox(self.appbox,
                                     label="&Groove Music",
                                     pos=(10, 105))
        self.mapbox = wx.CheckBox(self.appbox, label="&Maps", pos=(120, 15))
        self.mscbox = wx.CheckBox(self.appbox,
                                  label="Microso&ft Solitaire Collection",
                                  pos=(120, 105))
        self.moneybox = wx.CheckBox(self.appbox, label="Mone&y", pos=(120, 30))
        self.movietvbox = wx.CheckBox(self.appbox,
                                      label="Movies && T&V",
                                      pos=(120, 45))
        self.newsbox = wx.CheckBox(self.appbox, label="&News", pos=(120, 60))
        self.onenotebox = wx.CheckBox(self.appbox,
                                      label="OneNote Ap&p",
                                      pos=(120, 75))
        self.peoplebox = wx.CheckBox(self.appbox,
                                     label="P&eople",
                                     pos=(120, 90))
        self.phonebox = wx.CheckBox(self.appbox,
                                    label="Phone Compan&ion",
                                    pos=(225, 15))
        self.photosbox = wx.CheckBox(self.appbox,
                                     label="P&hotos",
                                     pos=(225, 30))
        self.sportsbox = wx.CheckBox(self.appbox,
                                     label="&Sports",
                                     pos=(225, 45))
        self.voicebox = wx.CheckBox(self.appbox,
                                    label="Voice &Recorder",
                                    pos=(225, 60))
        self.weatherbox = wx.CheckBox(self.appbox,
                                      label="&Weather",
                                      pos=(225, 75))
        self.xbonebox = wx.CheckBox(self.appbox, label="&Xbox", pos=(225, 90))

        self.selectapps = wx.CheckBox(self.appbox,
                                      label="Select all apps",
                                      pos=(246, 0),
                                      style=wx.ALIGN_RIGHT)
        self.Bind(wx.EVT_CHECKBOX, self.selectallapps, self.selectapps)

        self.removeappbut = wx.Button(self.appbox,
                                      wx.ID_ANY,
                                      label="Uninstall selected apps",
                                      pos=(10, 125))
        self.removeappbut.SetToolTip(
            wx.ToolTip(
                "Uninstalls all of the selected apps. Can take a lot of time.")
        )
        self.Bind(wx.EVT_BUTTON, self.uninstapps, self.removeappbut)

        self.reinstappbut = wx.Button(self.appbox,
                                      wx.ID_ANY,
                                      label="Reinstall original apps",
                                      pos=(205, 125))
        self.reinstappbut.SetToolTip(
            wx.ToolTip(
                "Reinstalls ALL of the default apps. Takes a lot of time."))
        self.Bind(wx.EVT_BUTTON, self.reinstapps, self.reinstappbut)

        # Service radio box
        self.serviceradbox = wx.RadioBox(panel,
                                         label="Service Method",
                                         pos=(135, 5),
                                         choices=("Disable", "Delete"))
        self.serviceradbox.Disable()
        self.serviceradbox.SetItemToolTip(
            0, "Simply disables the services. This can be undone.")
        self.serviceradbox.SetItemToolTip(
            1, "Deletes the services completely. This can't be undone.")

        # Go button
        self.gobutton = wx.Button(panel, wx.ID_ANY, label="Go!", pos=(275, 25))
        self.Bind(wx.EVT_BUTTON, self.go, self.gobutton)

        self.goradbox = wx.RadioBox(panel,
                                    label="Mode",
                                    pos=(284, 50),
                                    choices=("Privacy", "Revert"),
                                    style=wx.RA_SPECIFY_ROWS)

        self.goradbox.SetItemToolTip(
            0, "Using the selected settings, applies privacy.")
        self.goradbox.SetItemToolTip(
            1, "Reverts everything selected to it's original form")

        # Center and show the window
        self.Centre()
        self.Show()

    def serviceradioboxcheck(self, event):
        # Enables serviceradbox if the service box is ticked
        self.serviceradbox.Enable(self.servicebox.IsChecked())

    def telemetryhostcheck(self, event):
        # Automatically checks the domain block when the telemetry box is checked.
        self.hostbox.SetValue(self.telemetrybox.IsChecked())

    def extrahosthostcheck(self, event):
        # Warn users about the potential side effects of the extra hosts mod.
        hostwarn = wx.MessageDialog(
            parent=self,
            message=
            "This option could potentially prevent you from using one or more of the "
            "following services:\n\nSkype, Hotmail, Dr. Watson, Error Reporting.\n\n Continue?",
            caption="Attention!",
            style=wx.YES_NO | wx.ICON_EXCLAMATION)

        if self.extrahostbox.GetValue() == 1:
            if hostwarn.ShowModal() == wx.ID_NO:
                self.extrahostbox.SetValue(0)

        hostwarn.Destroy()

    def selectallapps(self, event):
        # Iters through all children of the app static box and checks them except for the last 3.
        # (buttons and the select all checkbox)
        for checkbox in list(self.appbox.GetChildren())[:-3]:
            checkbox.SetValue(self.selectapps.IsChecked())

    def aboutbox(self, event):
        # About dialog

        licensetext = "Copyright 2015 10se1ucgo\r\n\r\nLicensed under the Apache License, Version 2.0 " \
                      "(the \"License\");\r\nyou may not use this file except in compliance with the License." \
                      "\r\nYou may obtain a copy of the License at\r\n\r\n " \
                      "  http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or " \
                      "agreed to in writing, software\r\ndistributed under the License is distributed on an " \
                      "\"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." \
                      "\r\nSee the License for the specific language governing permissions and\r\nlimitations under " \
                      "the License."

        aboutpg = wx.AboutDialogInfo()
        aboutpg.Name = "Disable Windows 10 Tracking"
        aboutpg.Version = vernumber
        aboutpg.Copyright = "(c) 2015 10se1ucgo"
        aboutpg.Description = "A tool to disable nasty tracking in Windows 10"
        aboutpg.WebSite = ("https://github.com/10se1ucgo/DisableWinTracking",
                           "GitHub Project Page")
        aboutpg.License = wx.lib.wordwrap.wordwrap(licensetext, 500,
                                                   wx.ClientDC(self))
        aboutpg.Developers = ["10se1ucgo and Ruined1 on GitHub"]
        wx.AboutBox(aboutpg)

    def settingsbox(self, event):
        # Settings dialog
        settingsdialog = wx.Dialog(wx.GetApp().TopWindow, wx.ID_ANY,
                                   "Settings")

        boxsizer = wx.BoxSizer(wx.VERTICAL)

        normallist = (
            'a-0001.a-msedge.net', 'a-0002.a-msedge.net',
            'a-0003.a-msedge.net', 'a-0004.a-msedge.net',
            'a-0005.a-msedge.net', 'a-0006.a-msedge.net',
            'a-0007.a-msedge.net', 'a-0008.a-msedge.net',
            'a-0009.a-msedge.net', 'a-msedge.net', 'a.ads1.msn.com',
            'a.ads2.msads.net', 'a.ads2.msn.com', 'a.rad.msn.com',
            'ac3.msn.com', 'ad.doubleclick.net', 'adnexus.net', 'adnxs.com',
            'ads.msn.com', 'ads1.msads.net', 'ads1.msn.com', 'aidps.atdmt.com',
            'aka-cdn-ns.adtech.de', 'az361816.vo.msecnd.net',
            'az512334.vo.msecnd.net', 'b.ads1.msn.com', 'b.ads2.msads.net',
            'b.rad.msn.com', 'bs.serving-sys.com', 'c.atdmt.com', 'c.msn.com',
            'cdn.atdmt.com', 'cds26.ams9.msecn.net', 'choice.microsoft.com',
            'choice.microsoft.com.nsatc.net', 'compatexchange.cloudapp.net',
            'corp.sts.microsoft.com', 'corpext.msitadfs.glbdns2.microsoft.com',
            'cs1.wpc.v0cdn.net', 'db3aqu.atdmt.com',
            'df.telemetry.microsoft.com', 'diagnostics.support.microsoft.com',
            'ec.atdmt.com', 'feedback.microsoft-hohm.com',
            'feedback.search.microsoft.com', 'feedback.windows.com',
            'flex.msn.com', 'g.msn.com', 'h1.msn.com',
            'i1.services.social.microsoft.com',
            'i1.services.social.microsoft.com.nsatc.net',
            'lb1.www.ms.akadns.net', 'live.rads.msn.com', 'm.adnxs.com',
            'msedge.net', 'msftncsi.com', 'msnbot-65-55-108-23.search.msn.com',
            'msntest.serving-sys.com', 'oca.telemetry.microsoft.com',
            'oca.telemetry.microsoft.com.nsatc.net',
            'pre.footprintpredict.com', 'preview.msn.com', 'rad.live.com',
            'rad.msn.com', 'redir.metaservices.microsoft.com',
            'schemas.microsoft.akadns.net ', 'secure.adnxs.com',
            'secure.flashtalking.com', 'settings-sandbox.data.microsoft.com',
            'settings-win.data.microsoft.com',
            'sls.update.microsoft.com.akadns.net',
            'sqm.df.telemetry.microsoft.com', 'sqm.telemetry.microsoft.com',
            'sqm.telemetry.microsoft.com.nsatc.net', 'static.2mdn.net',
            'statsfe1.ws.microsoft.com', 'statsfe2.ws.microsoft.com',
            'telecommand.telemetry.microsoft.com',
            'telecommand.telemetry.microsoft.com.nsatc.net',
            'telemetry.appex.bing.net', 'telemetry.microsoft.com',
            'telemetry.urs.microsoft.com',
            'vortex-bn2.metron.live.com.nsatc.net',
            'vortex-cy2.metron.live.com.nsatc.net',
            'vortex-sandbox.data.microsoft.com',
            'vortex-win.data.microsoft.com', 'vortex.data.microsoft.com',
            'watson.live.com', 'www.msftncsi.com', 'ssw.live.com',
            'reports.wes.df.telemetry.microsoft.com',
            'services.wes.df.telemetry.microsoft.com',
            'web.vortex.data.microsoft.com',
            'vortex-win.data.metron.live.com.nsatc.net',
            'v10.vortex-win.data.microsoft.com',
            'vortex-cy2.metron.live.com.nsatc.net',
            'vortex.data.glbdns2.microsoft.com',
            'vortex-win.data.microsoft.com', 'vortex.data.microsoft.com')

        extralist = ('fe2.update.microsoft.com.akadns.net', 's0.2mdn.net',
                     'statsfe2.update.microsoft.com.akadns.net',
                     'survey.watson.microsoft.com', 'view.atdmt.com',
                     'watson.microsoft.com',
                     'watson.ppe.telemetry.microsoft.com',
                     'watson.telemetry.microsoft.com',
                     'watson.telemetry.microsoft.com.nsatc.net',
                     'wes.df.telemetry.microsoft.com', 'ui.skype.com',
                     'pricelist.skype.com', 'apps.skype.com', 'm.hotmail.com',
                     's.gateway.messenger.live.com')

        self.normalpicker = ItemsPicker(settingsdialog,
                                        id=wx.ID_ANY,
                                        choices=[],
                                        selectedLabel="Domains to be blocked",
                                        ipStyle=IP_SORT_SELECTED
                                        | IP_SORT_CHOICES
                                        | IP_REMOVE_FROM_CHOICES)
        self.normalpicker.SetSelections(normallist)

        self.extrapicker = ItemsPicker(
            settingsdialog,
            id=wx.ID_ANY,
            choices=[],
            selectedLabel="Extra domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        self.extrapicker.SetSelections(extralist)

        iplist = ('2.22.61.43', '2.22.61.66', '65.39.117.230', '65.55.108.23',
                  '23.218.212.69', '134.170.30.202', '137.116.81.24',
                  '157.56.106.189', '204.79.197.200', '65.52.108.33',
                  '64.4.54.254')

        self.ippicker = ItemsPicker(settingsdialog,
                                    id=wx.ID_ANY,
                                    choices=[],
                                    selectedLabel="IP addresses to be blocked",
                                    ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
                                    | IP_REMOVE_FROM_CHOICES)

        self.ippicker.SetToolTip(wx.ToolTip("Hello"))

        self.ippicker.SetSelections(iplist)

        boxsizer.Add(self.normalpicker, 0, wx.ALL | wx.TOP, 10)
        boxsizer.Add(self.extrapicker, 0, wx.ALL | wx.CENTER | wx.EXPAND, 10)
        boxsizer.Add(self.ippicker, 0, wx.ALL | wx.BOTTOM | wx.EXPAND, 10)

        settingsdialog.SetSizerAndFit(boxsizer)

        if event is not None:
            settingsdialog.Center()
            settingsdialog.ShowModal()

    def go(self, event):
        self.settingsbox(
            None)  # Call the settings box to get the settings values
        if self.goradbox.GetSelection() == 1:  # if mode is revert
            mode = "Revert"
            startval = 3
            telemetryval = 1
            undo = True
            val = 1
            filesyncval = 0
            installerfunc = "install"
        else:
            mode = "Privacy"
            startval = 4
            telemetryval = 0
            undo = False
            val = 0
            filesyncval = 1
            installerfunc = "uninstall"
            self.cluttercontrol()
            if self.diagtrackbox.IsChecked():
                logging.info("DiagTrack box ticked")
                cleardiagtracklog()
            if self.servicebox.IsChecked():
                if self.serviceradbox.Selection == 0:
                    logging.info("Service disable option ticked")
                    disableservice(service='dmwappushsvc')
                    disableservice(service='Diagnostics Tracking Service')
                elif self.serviceradbox.Selection == 1:
                    logging.info("Service delete option ticked")
                    deleteservice(service='dmwappushsvc')
                    deleteservice(service='Diagnostics Tracking Service')

        logging.info("DisableWinTracking Version: {0}".format(vernumber))
        logging.info("Mode: {0}".format(mode))
        if self.servicebox.IsChecked():
            modifyserviceregs(startval=startval)
        if self.telemetrybox.IsChecked():
            logging.info("Telemetry box ticked")
            modifytelemetryregs(telemetryval=telemetryval)
        if self.hostbox.IsChecked():
            self.settingsbox(None)
            logging.info("Host box ticked")
            modifyhostfile(undo=undo,
                           domainlist=self.normalpicker.GetSelections(),
                           name="Domain block")
        if self.extrahostbox.IsChecked():
            logging.info("Extra host box ticked")
            modifyhostfile(undo=undo,
                           domainlist=self.extrapicker.GetSelections(),
                           name="Extra domain block")
        if self.ipbox.IsChecked():
            logging.info("IP block box ticked")
            blockips(iplist=self.ippicker.GetSelections(), undo=undo)
        if self.wdwsbox.IsChecked():
            logging.info("Policy Manager box ticked")
            stopdefendwifi(val=val)
        if self.onedrivedbox.IsChecked():
            logging.info("OneDrive box ticked")
            modifyonedrive(installerfunc=installerfunc,
                           filesyncval=filesyncval)
        self.console.Show()  # Show console output window after the code is run
        self.console.Center()  # Center console window
        print "Done. It's recommended that you reboot as soon as possible for the full effect."
        print "If you feel something didn't work properly, please press the 'Report an issue' \
               button and follow the directions"

    def uninstapps(self, event):
        uninstalllist = []
        logging.info("DisableWinTracking Version: {0}".format(vernumber))

        if self.builderbox.IsChecked():
            uninstalllist.append('3dbuilder')
        if self.calmailbox.IsChecked():
            uninstalllist.append('windowscommunicationsapps')
        if self.camerabox.IsChecked():
            uninstalllist.append('windowscamera')
        if self.officebox.IsChecked():
            uninstalllist.append('officehub')
        if self.skypebox.IsChecked():
            uninstalllist.append('skypeapp')
        if self.startbox.IsChecked():
            uninstalllist.append('getstarted')
        if self.groovebox.IsChecked():
            uninstalllist.append('zunemusic')
        if self.mapbox.IsChecked():
            uninstalllist.append('windowsmaps')
        if self.mscbox.IsChecked():
            uninstalllist.append('solitairecollection')
        if self.moneybox.IsChecked():
            uninstalllist.append('bingfinance')
        if self.movietvbox.IsChecked():
            uninstalllist.append('zunevideo')
        if self.newsbox.IsChecked():
            uninstalllist.append('bingnews')
        if self.onenotebox.IsChecked():
            uninstalllist.append('onenote')
        if self.peoplebox.IsChecked():
            uninstalllist.append('people')
        if self.phonebox.IsChecked():
            uninstalllist.append('windowsphone')
        if self.photosbox.IsChecked():
            uninstalllist.append('photos')
        if self.sportsbox.IsChecked():
            uninstalllist.append('bingsports')
        if self.voicebox.IsChecked():
            uninstalllist.append('soundrecorder')
        if self.weatherbox.IsChecked():
            uninstalllist.append('bingweather')
        if self.xbonebox.IsChecked():
            uninstalllist.append('xboxapp')

        if uninstalllist:  # Check  if at least one app is selected
            apppackage(reinstall=False, applist=uninstalllist)
            self.console.Show(
            )  # Show console output window after the code is run
            self.console.Center()  # Center console window

    def reinstapps(self, event):
        apppackage(reinstall=True, applist=['thisshouldntevenbepassed'])

    def cluttercontrol(self):
        logging.info("Performing clutter control")
        if self.hostbox.IsChecked():
            modifyhostfile(undo=True,
                           domainlist=self.normalpicker.GetSelections(),
                           name="Clutter control")
        if self.extrahostbox.IsChecked():
            modifyhostfile(undo=True,
                           domainlist=self.extrapicker.GetSelections(),
                           name="Extra domain clutter control")
        if self.ipbox.IsChecked():
            blockips(undo=True)
        self.console.consolebox.Clear()
예제 #17
0
    def settings(self, event):
        dialog = wx.Dialog(parent=self,
                           title="Settings",
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        sizer = wx.BoxSizer(wx.VERTICAL)

        normal_domains = (
            'a-0001.a-msedge.net', 'a-0002.a-msedge.net',
            'a-0003.a-msedge.net', 'a-0004.a-msedge.net',
            'a-0005.a-msedge.net', 'a-0006.a-msedge.net',
            'a-0007.a-msedge.net', 'a-0008.a-msedge.net',
            'a-0009.a-msedge.net', 'a-msedge.net', 'a.ads1.msn.com',
            'a.ads2.msads.net', 'a.ads2.msn.com', 'a.rad.msn.com',
            'ac3.msn.com', 'ad.doubleclick.net', 'adnexus.net', 'adnxs.com',
            'ads.msn.com', 'ads1.msads.net', 'ads1.msn.com', 'aidps.atdmt.com',
            'aka-cdn-ns.adtech.de', 'az361816.vo.msecnd.net',
            'az512334.vo.msecnd.net', 'b.ads1.msn.com', 'b.ads2.msads.net',
            'b.rad.msn.com', 'bs.serving-sys.com', 'c.atdmt.com', 'c.msn.com',
            'cdn.atdmt.com', 'cds26.ams9.msecn.net', 'choice.microsoft.com',
            'choice.microsoft.com.nsatc.net', 'compatexchange.cloudapp.net',
            'corp.sts.microsoft.com', 'corpext.msitadfs.glbdns2.microsoft.com',
            'cs1.wpc.v0cdn.net', 'db3aqu.atdmt.com',
            'df.telemetry.microsoft.com', 'diagnostics.support.microsoft.com',
            'ec.atdmt.com', 'feedback.microsoft-hohm.com',
            'feedback.search.microsoft.com', 'feedback.windows.com',
            'flex.msn.com', 'g.msn.com', 'h1.msn.com',
            'i1.services.social.microsoft.com',
            'i1.services.social.microsoft.com.nsatc.net',
            'lb1.www.ms.akadns.net', 'live.rads.msn.com', 'm.adnxs.com',
            'msedge.net', 'msftncsi.com', 'msnbot-65-55-108-23.search.msn.com',
            'msntest.serving-sys.com', 'oca.telemetry.microsoft.com',
            'oca.telemetry.microsoft.com.nsatc.net',
            'pre.footprintpredict.com', 'preview.msn.com', 'rad.live.com',
            'rad.msn.com', 'redir.metaservices.microsoft.com',
            'reports.wes.df.telemetry.microsoft.com',
            'schemas.microsoft.akadns.net', 'secure.adnxs.com',
            'secure.flashtalking.com',
            'services.wes.df.telemetry.microsoft.com',
            'settings-sandbox.data.microsoft.com',
            'settings-win.data.microsoft.com',
            'sls.update.microsoft.com.akadns.net',
            'sqm.df.telemetry.microsoft.com', 'sqm.telemetry.microsoft.com',
            'sqm.telemetry.microsoft.com.nsatc.net', 'ssw.live.com',
            'static.2mdn.net', 'statsfe1.ws.microsoft.com',
            'statsfe2.ws.microsoft.com', 'telecommand.telemetry.microsoft.com',
            'telecommand.telemetry.microsoft.com.nsatc.net',
            'telemetry.appex.bing.net', 'telemetry.microsoft.com',
            'telemetry.urs.microsoft.com', 'v10.vortex-win.data.microsoft.com',
            'vortex-bn2.metron.live.com.nsatc.net',
            'vortex-cy2.metron.live.com.nsatc.net',
            'vortex-sandbox.data.microsoft.com',
            'vortex-win.data.metron.live.com.nsatc.net',
            'vortex-win.data.microsoft.com',
            'vortex.data.glbdns2.microsoft.com', 'vortex.data.microsoft.com',
            'watson.live.com', 'web.vortex.data.microsoft.com',
            'www.msftncsi.com')

        extra_domains = ('fe2.update.microsoft.com.akadns.net', 's0.2mdn.net',
                         'statsfe2.update.microsoft.com.akadns.net',
                         'survey.watson.microsoft.com', 'view.atdmt.com',
                         'watson.microsoft.com',
                         'watson.ppe.telemetry.microsoft.com',
                         'watson.telemetry.microsoft.com',
                         'watson.telemetry.microsoft.com.nsatc.net',
                         'wes.df.telemetry.microsoft.com', 'ui.skype.com',
                         'pricelist.skype.com', 'apps.skype.com',
                         'm.hotmail.com', 's.gateway.messenger.live.com')

        ip_addresses = ('2.22.61.43', '2.22.61.66', '65.39.117.230',
                        '65.55.108.23', '23.218.212.69', '134.170.30.202',
                        '137.116.81.24', '157.56.106.189', '204.79.197.200',
                        '65.52.108.33', '64.4.54.254')

        normal_domain_picker = ItemsPicker(
            dialog,
            choices=[],
            selectedLabel="Domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        if self.picked_normal:
            normal_domain_picker.SetSelections(self.picked_normal)
            normal_domain_picker.SetItems([
                domain for domain in normal_domains
                if domain not in self.picked_normal
            ])
        else:
            normal_domain_picker.SetSelections(normal_domains)

        extra_domain_picker = ItemsPicker(
            dialog,
            choices=[],
            selectedLabel="Extra domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        if self.picked_extra:
            extra_domain_picker.SetSelections(self.picked_extra)
            extra_domain_picker.SetItems([
                domain for domain in extra_domains
                if domain not in self.picked_extra
            ])
        else:
            extra_domain_picker.SetSelections(extra_domains)

        ip_picker = ItemsPicker(dialog,
                                choices=[],
                                selectedLabel="IP addresses to be blocked",
                                ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
                                | IP_REMOVE_FROM_CHOICES)
        if self.picked_ips:
            ip_picker.SetSelections(self.picked_ips)
            ip_picker.SetItems(
                [ip for ip in ip_addresses if ip not in self.picked_ips])
        else:
            ip_picker.SetSelections(ip_addresses)

        sizer.Add(normal_domain_picker, 0, wx.EXPAND)
        sizer.Add(extra_domain_picker, 0, wx.EXPAND)
        sizer.Add(ip_picker, 0, wx.EXPAND)
        if event is not None:
            dialog.SetSizerAndFit(sizer)
            dialog.Center()
            dialog.ShowModal()
        dialog.Destroy()
        self.picked_normal = normal_domain_picker.GetSelections()
        self.picked_extra = extra_domain_picker.GetSelections()
        self.picked_ips = ip_picker.GetSelections()
예제 #18
0
    def settings(self, event, silent=False):
        if not silent:
            dialog = wx.Dialog(parent=self,
                               title="Settings",
                               style=wx.DEFAULT_DIALOG_STYLE
                               | wx.RESIZE_BORDER)
            sizer = wx.BoxSizer(wx.VERTICAL)

        normal_domain_picker = ItemsPicker(
            dialog,
            choices=[],
            selectedLabel="Domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        if self.picked_normal:
            normal_domain_picker.SetSelections(self.picked_normal)
            normal_domain_picker.SetItems([
                domain for domain in normal_domains
                if domain not in self.picked_normal
            ])
        else:
            normal_domain_picker.SetSelections(normal_domains)

        extra_domain_picker = ItemsPicker(
            dialog,
            choices=[],
            selectedLabel="Extra domains to be blocked",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        if self.picked_extra:
            extra_domain_picker.SetSelections(self.picked_extra)
            extra_domain_picker.SetItems([
                domain for domain in extra_domains
                if domain not in self.picked_extra
            ])
        else:
            extra_domain_picker.SetSelections(extra_domains)

        ip_picker = ItemsPicker(dialog,
                                choices=[],
                                selectedLabel="IP addresses to be blocked",
                                ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
                                | IP_REMOVE_FROM_CHOICES)
        if self.picked_ips:
            ip_picker.SetSelections(self.picked_ips)
            ip_picker.SetItems(
                [ip for ip in ip_addresses if ip not in self.picked_ips])
        else:
            ip_picker.SetSelections(ip_addresses)

        whitelist_picker = ItemsPicker(
            dialog,
            choices=[],
            selectedLabel="Domains to be whitelisted",
            ipStyle=IP_SORT_SELECTED | IP_SORT_CHOICES
            | IP_REMOVE_FROM_CHOICES)
        if self.unpicked_ads:
            whitelist_picker.SetSelections(self.unpicked_ads)
            whitelist_picker.SetItems([
                domain for domain in adblock_whitelist
                if domain not in self.unpicked_ads
            ])
        else:
            whitelist_picker.SetSelections(adblock_whitelist)

        if not silent:
            sizer.Add(normal_domain_picker, 0, wx.EXPAND)
            sizer.Add(whitelist_picker, 0, wx.EXPAND)
            sizer.Add(extra_domain_picker, 0, wx.EXPAND)
            sizer.Add(ip_picker, 0, wx.EXPAND)
            if event is not None:
                dialog.SetSizerAndFit(sizer)
                dialog.Center()
                dialog.ShowModal()
            dialog.Destroy()

        self.unpicked_ads = whitelist_picker.GetSelections()
        self.picked_normal = normal_domain_picker.GetSelections()
        self.picked_extra = extra_domain_picker.GetSelections()
        self.picked_ips = ip_picker.GetSelections()