Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup_widgets(self):
Editor.setup_widgets(self)
cursors = {}
for axis in self._axis_data:
if "trig" in axis.name:
continue
axis.cursor = cursors[axis.area] = ( cursors.get(axis.area) or
Gtk.Image.new_from_file(os.path.join(
self.app.imagepath, "test-cursor.svg")) )
axis.cursor.position = [ 0, 0 ]
self.builder.get_object("cbInvert_1").set_active(True)
self.builder.get_object("cbInvert_3").set_active(True)
self.builder.get_object("cbInvert_5").set_active(True)
Currently setups only one thing...
"""
from __future__ import unicode_literals
from scc.tools import _
from gi.repository import Gdk, GObject, GLib, GdkPixbuf
from scc.paths import get_controller_icons_path, get_default_controller_icons_path
from scc.actions import Action
from scc.gui.userdata_manager import UserDataManager
from scc.gui.editor import Editor, ComboSetter
import re, sys, os, logging
log = logging.getLogger("GS")
class ControllerSettings(Editor, UserDataManager, ComboSetter):
GLADE = "controller_settings.glade"
def __init__(self, app, controller, profile_switcher=None):
UserDataManager.__init__(self)
self.app = app
self.controller = controller
self.profile_switcher = profile_switcher
self.setup_widgets()
self.load_icons()
self._timer = None
self.app.config.reload()
self.load_settings()
self._eh_ids = ()
def load_icons(self):
def setup_widgets(self):
Editor.setup_widgets(self)
b = lambda a : self.builder.get_object(a)
self.action_widgets = (
# Order goes: Action Button, Clear Button
( b('btInner'), b('btClearInner') ),
( b('btOuter'), b('btClearOuter') )
)
headerbar(self.builder.get_object("header"))
def install_error_css():
if Editor._error_css_provider is None:
Editor._error_css_provider = Gtk.CssProvider()
Editor._error_css_provider.load_from_data(str(Editor.ERROR_CSS))
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
Editor._error_css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_USER)
from scc.tools import _
from scc.gui.controller_widget import ControllerButton
from scc.gui.controller_widget import STICKS, PADS
from scc.gui.editor import Editor, ComboSetter
from scc.gui.dwsnc import headerbar
from scc.modifiers import ModeModifier, DoubleclickModifier, HoldModifier
from scc.actions import Action, RingAction, NoAction, MultiAction
from scc.constants import SCButtons
from scc.profile import Profile
from gi.repository import Gtk, Gdk, GLib
import os, logging
log = logging.getLogger("RingEditor")
class RingEditor(Editor, ComboSetter):
GLADE = "ring_editor.glade"
def __init__(self, app, callback):
Editor.__init__(self)
self.app = app
self.id = None
self.mode = Action.AC_BUTTON
self.ac_callback = callback
self.radius = 0.5
self.actions = [ NoAction(), NoAction() ]
self.setup_widgets()
def setup_widgets(self):
Editor.setup_widgets(self)
b = lambda a : self.builder.get_object(a)
def setup_widgets(self):
Editor.setup_widgets(self)
headerbar(self.builder.get_object("header"))
from scc.gui.creg.data import AxisData, DPadEmuData
from scc.gui.creg.tester import Tester
from scc.gui.controller_image import ControllerImage
from scc.gui.editor import Editor
from scc.gui.app import App
from scc.constants import SCButtons, STICK_PAD_MAX, STICK_PAD_MIN
from scc.paths import get_config_path, get_share_path
from scc.tools import nameof, clamp
from scc.config import Config
import evdev
import os, logging, json, re
log = logging.getLogger("CRegistration")
class ControllerRegistration(Editor):
GLADE = "creg.glade"
UNASSIGNED_COLOR = "#FFFF0000" # ARGB
OBSERVE_COLORS = (
App.OBSERVE_COLOR,
# Following just replaces 'full alpha' in ARGB with various alpha values
App.OBSERVE_COLOR.replace("#FF", "#DF"),
App.OBSERVE_COLOR.replace("#FF", "#BF"),
App.OBSERVE_COLOR.replace("#FF", "#9F"),
App.OBSERVE_COLOR.replace("#FF", "#7F"),
)
def __init__(self, app):
Editor.__init__(self)
self.app = app
self._gamepad_icon = GdkPixbuf.Pixbuf.new_from_file(
os.path.join(self.app.imagepath, "controller-icons", "evdev-0.svg"))
def setup_widgets(self):
Editor.setup_widgets(self)
clIcon = self.builder.get_object("clIcon")
crIconName = self.builder.get_object("crIconName")
btUserFolder = self.builder.get_object("btUserFolder")
cr = CellRendererMenuIcon(32)
clIcon.clear()
clIcon.pack_start(cr, False)
clIcon.pack_start(crIconName, True)
clIcon.set_attributes(cr, icon=1, has_colors=2)
clIcon.set_attributes(crIconName, text=0)
btUserFolder.set_label("Add icons...")
btUserFolder.set_uri("file://%s" % (get_menuicons_path(),))
headerbar(self.builder.get_object("header"))
self.load_menu_icons()
def setup_widgets(self):
Editor.setup_widgets(self)
cursors = {}
for axis in self._axis_data:
if "trig" in axis.name:
continue
axis.cursor = cursors[axis.area] = ( cursors.get(axis.area) or
Gtk.Image.new_from_file(os.path.join(
self.app.imagepath, "test-cursor.svg")) )
axis.cursor.position = [ 0, 0 ]
self.builder.get_object("cbInvert_1").set_active(True)
self.builder.get_object("cbInvert_3").set_active(True)
self.builder.get_object("cbInvert_5").set_active(True)
from scc.gui.osk_binding_editor import OSKBindingEditor
from scc.gui.userdata_manager import UserDataManager
from scc.gui.editor import Editor, ComboSetter
from scc.gui.parser import GuiActionParser
from scc.gui.dwsnc import IS_UNITY
# from scc.x11.autoswitcher import AutoSwitcher, Condition
# from scc.osd.menu_generators import RecentListMenuGenerator
# from scc.osd.menu_generators import WindowListMenuGenerator
# from scc.osd.keyboard import Keyboard as OSDKeyboard
# from scc.osd.osk_actions import OSKCursorAction
# import scc.osd.osk_actions
import re, sys, os, json, logging, traceback
log = logging.getLogger("GS")
class GlobalSettings(Editor, UserDataManager, ComboSetter):
GLADE = "global_settings.glade"
DEFAULT_MENU_OPTIONS = [
# label, order, class, icon, parameter
# TODO: Disabled
# ('Recent profiles', 0, RecentListMenuGenerator, None, 3),
# ('Autoswitch Options', 1, Submenu, 'system/autoswitch', '.autoswitch.menu'),
# ('Switch To', 1, Submenu, 'system/windowlist', '.windowlist.menu'),
# ('Display Keyboard', 2, MenuItem, 'system/keyboard', 'keyboard()'),
# ('Turn Controller OFF', 2, MenuItem, 'system/turn-off', 'osd(turnoff())'),
('Kill Current Window', 1, MenuItem, 'weapons/pistol-gun',
"dialog('Really? Non-saved progress or data will be lost', "
"name('Back', None), "
"name('Kill', shell('kill -9 $(xdotool getwindowfocus getwindowpid)')))"),
('Run Program...', 1, MenuItem, 'system/cog',
'shell("scc-osd-launcher")'),