Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (c) 2014 Angelo Naselli <anaselli@linux.it>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@anaselli
anaselli / progressbar.patch
Created April 10, 2017 20:33
Possible workaround to max recursion in progress bar set value and libyui gtk bindings
diff --git a/dnfdragora/progress_ui.py b/dnfdragora/progress_ui.py
index 3096142..9840862 100644
--- a/dnfdragora/progress_ui.py
+++ b/dnfdragora/progress_ui.py
@@ -74,7 +74,10 @@ class ProgressBar:
def set_progress(self, frac, label=None) :
if label is not None:
self.progressbar.setLabel(label)
- self.progressbar.setValue(int(100*frac))
+ val = self.progressbar.value()
@anaselli
anaselli / test-YtableCell.cc
Created January 27, 2018 12:32
Changing an YtableCell does not work as expected and looses a coulmn entry (Gtk and ncurses)
// g++ -I/usr/include/yui -lyui test-YtableCell.cc -o test-YtableCell
#include <sstream>
#include "YUI.h"
#include "YApplication.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YEvent.h"
#include "YTable.h"
@anaselli
anaselli / firewalld-client.py
Last active May 13, 2019 15:23
firewalld client connection and connection-changed event
from firewall.client import FirewallClient
import threading
from gi.repository import GLib
def fwConnectionChanged():
print ("event connection changed")
def glib_mainloop(loop):
loop.run()
@anaselli
anaselli / updater-icon.patch
Created June 26, 2019 17:49
Patch to overrideicon theme if option is passed to command line
diff --git a/dnfdragora/updater.py b/dnfdragora/updater.py
index 8e2ba89..ed67074 100644
--- a/dnfdragora/updater.py
+++ b/dnfdragora/updater.py
@@ -57,7 +57,8 @@ class Updater:
else:
icon_path = icon_path + '/dnfdragora.png'
- theme_icon_pathname = self.__get_theme_icon_pathname() or icon_path
+ theme_icon_pathname = icon_path if 'icon-path' in options.keys() else self.__get_theme_icon_pathname() or icon_path
@anaselli
anaselli / MenuBar-yui.cc
Last active November 2, 2020 21:12
MenuBar yui example
/*
* Copyright 2020 by Angelo Naselli <anaselli at linux dot it>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) version 3.0 of the License. This library
* is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
@anaselli
anaselli / SelectionBox-icons.cc
Created November 5, 2020 14:57
Selection box example with icons
// Simple SelectionBox example.
//
// Compile with:
//
// g++ -I/usr/include/yui -lyui SelectionBox-icons.cc -o SelectionBox1-icons
#define YUILogComponent "example"
#include "YUILog.h"
#include "YUI.h"
@anaselli
anaselli / menubar.py
Created November 22, 2020 15:30
Python YMenuBar example for libyui-bindings
# vim: set et ts=4 sw=4:
#coding:utf-8
#############################################################################
#
# menubar.py - Show a dialog with YMenuBar implementation
#
# License: GPLv2+
# Author: Angelo Naselli <anaselli@linux.it>
#############################################################################
// g++ -I/usr/include/yui -lyui test-YTable.cc -o test-YTable
#include <sstream>
#include "YUI.h"
#include "YApplication.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YEvent.h"
#include "YTable.h"
@anaselli
anaselli / testSortYTable.cc
Created December 13, 2020 19:53
A test example to manage sorting on YTable
// g++ -I/usr/include/yui -lyui testSortYTable.cc -o testSortYTable
#include <sstream>
#include "YUI.h"
#include "YApplication.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YEvent.h"
#include "YTable.h"