Пример #1
0
 def __init__(self, bus_name):
     from PreferencesDialog import PreferencesDialog
     dbus.service.Object.__init__(
         self,
         bus_name=bus_name,
         object_path='/edu/wisc/cs/cbi/Preferences')
     self.dialog = PreferencesDialog()
Пример #2
0
    def on_preferences(self, event):
        prefs_dialog = PreferencesDialog(
            self,
            major_increment=self.get_major_increment(),
            minor_increment=self.get_minor_increment())
        retcon = prefs_dialog.ShowModal()

        if retcon == 1:
            prefs = prefs_dialog.get_prefs()
            self.set_major_increment(prefs['major_increment'])
            self.set_minor_increment(prefs['minor_increment'])
Пример #3
0
 def openDialog(self):
     dialog = PreferencesDialog(self)
     if dialog.ShowModal() == wx.ID_OK:
         # CONTINUE: Validate.
         for subject in self.default:
             category = subject[0]
             for (field, value, width) in subject[1:]:
                 if type(value) == type([]):
                     self.data[category][field] = \
                         value[dialog.controls[category][field].\
                                   GetSelection()]
                 else:
                     self.data[category][field] = \
                         dialog.controls[category][field].GetValue()
     dialog.Destroy()
Пример #4
0
 def __init__(self, callback):
     if Preferences._singleton:
         raise 'Singleton recreated'
     Preferences._singleton = self
     title = "GRiNS Preferences"
     PreferencesDialog.__init__(self, title)
     self.bool_names = self.getboolnames()
     self.int_names = self.getintnames()
     self.string_names = self.getstringnames()
     if hasattr(self, 'getfloatnames'):
         self.float_names = self.getfloatnames()
     else:
         self.float_names = []
     self.callback = callback
     self.load_settings()
     self.show()
Пример #5
0
    def show_signin_dialog(self, auto_signin=True):
        self.profile = None
        signin = SigninDialog(self, auto_signin=auto_signin)
        signin.run()
        signin.destroy()

        if self.profile:
            if self.profile['first-run']:
                self.profile['first-run'] = False
                preferences = PreferencesDialog(self)
                preferences.run()
                preferences.destroy()

            self.home_page.load()
            self.download_page.load()
        else:
            self.quit()
Пример #6
0
class Server(dbus.service.Object):

    __slots__ = ['dialog']

    def __init__(self, bus_name):
        from PreferencesDialog import PreferencesDialog
        dbus.service.Object.__init__(
            self,
            bus_name=bus_name,
            object_path='/edu/wisc/cs/cbi/Preferences')
        self.dialog = PreferencesDialog()

    @dbus.service.method(dbus_interface='edu.wisc.cs.cbi.Preferences',
                         in_signature='',
                         out_signature='')
    def present(self):
        self.dialog.present()
Пример #7
0
 def on_preferences_action_activated(self, action, params):
     if self.profile:
         dialog = PreferencesDialog(self)
         dialog.run()
         dialog.destroy()
         if self.profile:
             gutil.dump_profile(self.profile)
             if self.profile['use-status-icon'] and not self.status_icon:
                 self.init_status_icon()
Пример #8
0
    def show_signin_dialog(self, auto_signin=True):
        self.profile = None
        signin = SigninDialog(self, auto_signin=auto_signin)
        signin.run()
        signin.destroy()

        if self.profile:
            self.init_notebook()
            self.notebook.connect('switch-page', self.on_notebook_switched)
            self.init_status_icon()
            self.init_notify()

            if self.profile['first-run']:
                self.profile['first-run'] = False
                preferences = PreferencesDialog(self)
                preferences.run()
                preferences.destroy()
                gutil.dump_profile(self.profile)

            self.home_page.load()
            self.switch_page(self.home_page)
            return
        self.quit()
Пример #9
0
    def __init__(self, parent, preferences, easyChords):
        self.pref = preferences
        self.frame = self
        PreferencesDialog.__init__(self, parent)

        self.easyChords = easyChords

        self.fontCB.Bind(wx.EVT_TEXT_ENTER, self.OnFontSelected, self.fontCB)
        self.fontCB.Bind(wx.EVT_COMBOBOX, self.OnFontSelected, self.fontCB)

        previewSong = _(
            "{t:My Bonnie}\n\nMy [D]Bonnie lies [G]over the [D]ocean\noh [G]bring back my [A]Bonnie to [D]me!\n\n{soc}\n[D]Bring back, [E-]bring back,\n[A]bring back my Bonnie to [D]me!\n{eoc}"
        )
        self.editor.SetText(previewSong)
        self.editor.SetFont(self.pref.editorFace, self.pref.editorSize)
        self.editor.SetReadOnly(True)
        self.autoRemoveBlankLines.SetValue(self.pref.autoAdjustSpuriousLines)
        self.autoTab2Chordpro.SetValue(self.pref.autoAdjustTab2Chordpro)
        self.autoAdjustEasyKey.SetValue(self.pref.autoAdjustEasyKey)
        if self.pref.locale is None:
            lang = i18n.getLang()
        else:
            lang = self.pref.locale
        for l in glb.languages:
            i = self.langCh.Append(glb.languages[l])
            self.langCh.SetClientData(i, l)
            if lang == l:
                self.langCh.SetSelection(i)
        exts = ["crd", "pro", "chopro", "chordpro", "cho"]
        i = 0
        for e in exts:
            self.extension.Append(e)
            if e == self.pref.defaultExtension:
                self.extension.SetSelection(i)
            i += 1

        # Default notation
        for n in self.pref.notations:
            i = self.notationCh.Append(n.desc)
            self.notationCh.SetClientData(i, n.id)
        self.notationCh.SetSelection(0)

        # Update frequency
        sel = 0
        uf = get_update_frequencies()
        for k in uf:
            i = self.frequency.Append(uf[k])
            self.frequency.SetClientData(i, k)
            if k == self.pref.updateFrequency:
                sel = i
        self.frequency.SetSelection(sel)

        # Easy chords
        simplifyGrid = wx.FlexGridSizer(len(easyChords), 2, 0, 0)
        simplifyGrid.AddGrowableCol(1, 1)
        self.simplifyPanel.SetSizer(simplifyGrid)
        self.simplifyPanel.Layout()

        self.decoSliders = {}
        for k in easyChordsOrder:
            simplifyGrid.Add(
                wx.StaticText(self.simplifyPanel, wx.ID_ANY,
                              getEasyChordsDescription(easyChords[k]),
                              wx.DefaultPosition, wx.DefaultSize, 0), 0,
                wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
            ds = MyDecoSlider(self.simplifyPanel)
            self.decoSliders[k] = ds
            ds.slider.SetValue(self.pref.GetEasyChordsGroup(k))
            simplifyGrid.Add(ds, 1, wx.EXPAND, 5)

        simplifyGrid.FitInside(self.simplifyPanel)
Пример #10
0
 def close(self):
     self.callback = None
     Preferences._singleton = None
     PreferencesDialog.close(self)
Пример #11
0
 def on_preferences_action_activated(self, action, params):
     dialog = PreferencesDialog(self)
     dialog.run()
     dialog.destroy()
     if self.profile:
         Config.dump_profile(self.profile)
Пример #12
0
	def __init__(self, parent, preferences, easyChords):
		self.pref = preferences
		self.frame = self
		PreferencesDialog.__init__(self, parent)

		self.easyChords = easyChords

		self.fontCB.Bind(wx.EVT_TEXT_ENTER, self.OnFontSelected, self.fontCB)
		self.fontCB.Bind(wx.EVT_COMBOBOX, self.OnFontSelected, self.fontCB)

		previewSong = _("{t:My Bonnie}\n\nMy [D]Bonnie lies [G]over the [D]ocean\noh [G]bring back my [A]Bonnie to [D]me!\n\n{soc}\n[D]Bring back, [E-]bring back,\n[A]bring back my Bonnie to [D]me!\n{eoc}")
		self.editor.SetText(previewSong)
		self.editor.SetFont(self.pref.editorFace, self.pref.editorSize)
		self.editor.SetReadOnly(True)
		self.autoRemoveBlankLines.SetValue(self.pref.autoAdjustSpuriousLines)
		self.autoTab2Chordpro.SetValue(self.pref.autoAdjustTab2Chordpro)
		self.autoAdjustEasyKey.SetValue(self.pref.autoAdjustEasyKey)
		if self.pref.locale is None:
			lang = i18n.getLang()
		else:
			lang = self.pref.locale
		for l in glb.languages:
			i = self.langCh.Append(glb.languages[l])
			self.langCh.SetClientData(i, l)
			if lang == l:
				self.langCh.SetSelection(i)
		exts = ["crd", "pro", "chopro", "chordpro", "cho"]
		i = 0
		for e in exts:
			self.extension.Append(e)
			if e == self.pref.defaultExtension:
				self.extension.SetSelection(i)
			i += 1
				
		# Default notation
		for n in self.pref.notations:
			i = self.notationCh.Append(n.desc)
			self.notationCh.SetClientData(i, n.id)
		self.notationCh.SetSelection(0)		

		# Update frequency
		sel = 0
		uf = get_update_frequencies()
		for k in uf:
			i = self.frequency.Append(uf[k])
			self.frequency.SetClientData(i, k)
			if k == self.pref.updateFrequency:
				sel = i
		self.frequency.SetSelection(sel)

		# Easy chords
		simplifyGrid = wx.FlexGridSizer(len(easyChords), 2, 0, 0)
		simplifyGrid.AddGrowableCol(1, 1)
		self.simplifyPanel.SetSizer(simplifyGrid)
		self.simplifyPanel.Layout()

		self.decoSliders = {}
		for k in easyChordsOrder:
			simplifyGrid.Add(wx.StaticText(self.simplifyPanel, wx.ID_ANY, getEasyChordsDescription(easyChords[k]), wx.DefaultPosition, wx.DefaultSize, 0), 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
			ds = MyDecoSlider(self.simplifyPanel)
			self.decoSliders[k] = ds
			ds.slider.SetValue(self.pref.GetEasyChordsGroup(k))
			simplifyGrid.Add(ds, 1, wx.EXPAND, 5)

		simplifyGrid.FitInside(self.simplifyPanel)