Skip to content

Instantly share code, notes, and snippets.

View davidas13's full-sized avatar
🎯
Learn for life! 🧬 Don't rely on Magic ✨

David Satrio davidas13

🎯
Learn for life! 🧬 Don't rely on Magic ✨
View GitHub Profile
from PyQt5.QtCore import QDate, QTime, QDateTime, Qt
now = QDate.currentDate()
print(now.toString(Qt.ISODate))
print(now.toString(Qt.DefaultLocaleLongDate))
print(now.toString(Qt.DefaultLocaleShortDate))
date_time = QDateTime.currentDateTime()
print(date_time.toString())
from PyQt5.QtCore import QDate, QTime, QDateTime, Qt
now = QDate.currentDate()
print(now.toString(Qt.ISODate))
print(now.toString(Qt.DefaultLocaleLongDate))
print(now.toString(Qt.DefaultLocaleShortDate))
date_time = QDateTime.currentDateTime()
print(date_time.toString())
@davidas13
davidas13 / maya_floating_win.py
Created June 25, 2018 07:44 — forked from fredrikaverpil/maya_floating_win.py
Window floating atop Maya 2017
from PySide2 import QtWidgets, QtCore
def _maya_main_window():
"""Return Maya's main window"""
for obj in QtWidgets.qApp.topLevelWidgets():
if obj.objectName() == 'MayaWindow':
return obj
raise RuntimeError('Could not find MayaWindow instance')
# -*- coding: utf-8 -*-
#PyQt4.QtGui imports
from PyQt4.QtGui import QApplication
from PyQt4.QtGui import QMainWindow
from PyQt4.QtGui import QTextEdit
from PyQt4.QtGui import QMenu
from PyQt4.QtGui import QCursor
#PyQt4.QtGui imports
@davidas13
davidas13 / redirect.py
Created May 11, 2019 07:18 — forked from rbonvall/redirect.py
Redirect both stdin and stdout of a process to a PyQt text edit.
from PyQt4 import QtGui, QtCore, uic
def p(x):
print x
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QWidget.__init__(self)
uic.loadUi('redirect.ui', self)
/*Complex Selector Example*/
QLineEdit { color: red }
QLineEdit[readOnly="true"] { color: gray }
QDialog QLineEdit { color: brown }
/*Customizing QAbstractScrollArea*/
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: scroll; /*If the background-image is to be fixed with the viewport: scroll or fixed*/
}
@davidas13
davidas13 / attrdict.py
Created September 5, 2019 13:28 — forked from turicas/attrdict.py
Python class with dict-like get/set item
#!/usr/bin/env python
# coding: utf-8
class AttrDict(object):
def __init__(self, init=None):
if init is not None:
self.__dict__.update(init)
def __getitem__(self, key):
return self.__dict__[key]
@davidas13
davidas13 / godot_style_guide.md
Created September 20, 2019 12:22 — forked from fire/godot_style_guide.md
godot_style_guide

Example Project Content Structure

|-- addons
|   |-- auto_lod
|   |   |-- art
|   |   |-- core
|   |   |-- binaries
|   |-- spring_arm
|-- generic_shooter
@davidas13
davidas13 / swipe.lua
Created October 14, 2019 13:11 — forked from AGulev/swipe.lua
adoptation of swipe-direction script by ScottPhillips https://github.com/ScottPhillips/swipe-direction/blob/master/swipe-direction.lua for Defold engine
local beginX
local beginY
local endX
local endY
local startTime
local xDistance
local yDistance
@davidas13
davidas13 / version_controll_addon.gd
Created November 4, 2019 05:45 — forked from marcosbitetti/version_controll_addon.gd
A version control helper to using in Godot Engine
##
# Automatic versioning the code using GIT
# need GIT instaled on OS
func _dev_auto_commit():
if OS.is_debug_build():
var path = '/usr/bin/git'
var finder = File.new()
if not finder.file_exists(path):
if finder.file_exists('/usr/sbin/git'):
path = '/usr/sbin/git'